2013 ACM-ICPC南京赛区全国邀请赛

题目链接:http://acm.hdu.edu.cn/search.php?field=problem&key=2013 ACM-ICPC南京赛区全国邀请赛——题目重现&source=1&searchmode=source

A(HDU4586)

Play the Dice

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)

Total Submission(s): 1298    Accepted Submission(s): 416

Special Judge

Problem Description

There is a dice with n sides, which are numbered from 1,2,...,n and have the equal possibility to show up when one rolls a dice. Each side has an integer ai on it. Now here is a game that you can roll this dice once, if the i-th side is up, you will get ai
yuan. What‘s more, some sids of this dice are colored with a special different color. If you turn this side up, you will get once more chance to roll the dice. When you roll the dice for the second time, you still have the opportunity to win money and rolling
chance. Now you need to calculate the expectations of money that we get after playing the game once.

Input

Input consists of multiple cases. Each case includes two lines.

The first line is an integer n (2<=n<=200), following with n integers ai(0<=ai<200)

The second line is an integer m (0<=m<=n), following with m integers bi(1<=bi<=n), which are the numbers of the special sides to get another more chance.

Output

Just a real number which is the expectations of the money one can get, rounded to exact two digits. If you can get unlimited money, print inf.

Sample Input

6 1 2 3 4 5 6

0

4 0 0 0 0

1 3

Sample Output

3.50

0.00

(代码是队友写的)

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    int n,a[205],b[205],sum;
    double ans;
    while(scanf("%d",&n)!=EOF)
    {
        sum=0;
        ans=0.0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            sum+=a[i];
        }
        int m;
        scanf("%d",&m);
        for(int j=0;j<m;j++)
            scanf("%d",&b[j]);
        if(sum==0){printf("0.00\n");continue;}
        else if(n==m){printf("inf\n");continue;}
        else {
            ans=sum/(double)(n-m);
        }
        printf("%.2lf\n",ans);
    }
    return 0;
}

E(HDU 4593)

Robot

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)

Total Submission(s): 451    Accepted Submission(s): 326

Problem Description

A robot is a mechanical or virtual artificial agent, usually an electro-mechanical machine that is guided by a computer program or electronic circuitry. Robots can be autonomous or semi-autonomous and range from humanoids such as Honda‘s Advanced Step in Innovative
Mobility (ASIMO) and Tosy‘s TOSY Ping Pong Playing Robot (TOPIO) to industrial robots, collectively programmed ‘swarm‘ robots, and even microscopic nano robots. By mimicking a lifelike appearance or automating movements, a robot may convey a sense of intelligence
or thought of its own.

Robots have replaced humans in the assistance of performing those repetitive and dangerous tasks which humans prefer not to do, or are unable to do due to size limitations, or even those such as in outer space or at the bottom of the sea where humans could
not survive the extreme environments.

After many years, robots have become very intellective and popular. Glad Corporation is a big company that produces service robots. In order to guarantee the safety of production, each robot has an unique number (each number is selected from 1 to N and will
be recorded when the robot is produced).

But one day we found that N+1 robots have been produced in the range of 1 to N , that‘s to say one number has been used for 2 times. Now the president of Glad Corporation hopes to find the reused number as soon as possible.

Input

Multiple cases, end with EOF.

In each case, The first line has one number N, which represents the maximum number. The next line has N +1 numbers. (All numbers are between 1 to N, and only two of them are the same.) (1 <= N <= 103)

Output

Each case, output a line with the reused number.

There are no black lines between cases.

Sample Input

2

1 2 1

1

1 1

Sample Output

1

1

(代码是队友的)

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <cctype>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <limits>
#include <fstream>

using namespace std;

#define mem(A, X) memset(A, X, sizeof A)
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define vi vector<int>
#define all(x) x.begin(), x.end()
#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
#define sz(x) (int)((x).size())
#define sl(a) strlen(a)
#define rep(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define Rep(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define dbg(a) cout << a << endl;
#define fi first
#define se second
typedef long long int64;
int gcd(const int64 &a, const int64 &b) {return b == 0 ? a : gcd(b, a % b);}
int64 int64pow(int64 a, int64 b){if(b == 0) return 1;int64 t = int64pow(a, b / 2);if(b % 2) return t * t * a;return t * t;}
const int inf = 1 << 30;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int MAX_N = 10005;

int n, arr[MAX_N];
int flag[10007];
int main()
{
    while (cin >> n) {
        memset(arr,0,sizeof(arr));
        memset(flag,0,sizeof(flag));
        /*Rep(i, 0, n) {
            cin >> arr[i];
        }
        sort(arr, arr + n + 1);
         for(int i=0;i<=n-1;i++) {
            if (arr[i] == arr[i + 1])
                cout << arr[i] << endl;
                break;
        }*/
        int a;
        for(int i=0;i<=n;i++)
        {
            scanf("%d",&a);
            flag[a]++;
        }
        int ans;
        for(int i=1;i<=n;i++)
        {
            if(flag[i]>1) ans=i;
        }
        printf("%d\n",ans);
    }
    return 0;
}

G(HDU 4596)

Yet another end of the world

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)

Total Submission(s): 555    Accepted Submission(s): 269

Problem Description

In the year 3013, it has been 1000 years since the previous predicted rapture. However, the Maya will not play a joke any more and the Rapture finally comes in. Fortunately people have already found out habitable planets, and made enough airships to convey
all the human beings in the world. A large amount of airships are flying away the earth. People all bear to watch as this planet on which they have lived for millions of years. Nonetheless, scientists are worrying about anther problem…

As we know that long distance space travels are realized through the wormholes, which are given birth by the distortion of the energy fields in space. Airships will be driven into the wormholes to reach the other side of the universe by the suction devices
placed in advance. Each wormhole has its configured attract parameters, X, Y or Z. When the value of ID%X is in [Y,Z], this spaceship will be sucked into the wormhole by the huge attraction. However, the spaceship would be tear into piece if its ID meets the
attract parameters of two wormholes or more at the same time.

All the parameters are carefully adjusted initially, but some conservative, who treat the Rapture as a grain of truth and who are reluctant to abandon the treasure, combine with some evil scientists and disrupt the parameters. As a consequence, before the spaceships
fly into gravity range, we should know whether the great tragedy would happen or not. Now the mission is on you.

Input

Multiple test cases, ends with EOF.

In each case, the first line contains an integer N(N<=1000), which means the number of the wormholes.

Then comes N lines, each line contains three integers X,Y,Z(0<=Y<=Z<X<2*109).

Output

If there exists danger, output “Cannot Take off”, else output “Can Take off”.

Sample Input

2

7 2 3

7 5 6

2

7 2 2

9 2 2

Sample Output

Can Take off

Cannot Take off

(代码是队友的)

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <cctype>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <limits>
#include <fstream>

using namespace std;

#define mem(A, X) memset(A, X, sizeof A)
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define vi vector<int>
#define all(x) x.begin(), x.end()
#define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
#define sz(x) (int)((x).size())
#define sl(a) strlen(a)
#define rep(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define Rep(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define dbg(a) cout << a << endl;
#define fi first
#define se second
typedef long long int64;
int gcd(const int64 &a, const int64 &b) {return b == 0 ? a : gcd(b, a % b);}
int64 int64pow(int64 a, int64 b){if(b == 0) return 1;int64 t = int64pow(a, b / 2);if(b % 2) return t * t * a;return t * t;}
const int inf = 1 << 30;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int MAX_N = 1005;

int n, m;
int x[MAX_N],y[MAX_N],z[MAX_N];

bool ok(int t, int l, int r)
{
    if(l % t == 0 || r % t == 0) return true ;
    if(l < 0 && r >= 0) return true ;
    if(r / t - l / t > 0) return true ;
    return false ;
}
bool solve()
{
    int tmp;
    Rep(i, 1, n) {
        Rep(j, i + 1, n) {
            tmp = gcd(x[i], x[j]);
            if(ok(tmp, y[i] - z[j], z[i] - y[j])) return true ;
        }
    }
    return false ;
}
int main()
{
    while(~scanf("%d",&n))
    {
        Rep(i, 1, n) {
            scanf("%d%d%d",&x[i],&y[i],&z[i]);
        }
        if(solve())
            printf("Cannot Take off\n");
        else
            printf("Can Take off\n");
    }
    return 0;
}
时间: 2024-08-28 23:02:27

2013 ACM-ICPC南京赛区全国邀请赛的相关文章

HDU 4573 Throw the Stones(动态三维凸包)(2013 ACM-ICPC长沙赛区全国邀请赛)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4573 Problem Description Remember our childhood? A few naked children throw stones standing on the same position, the one throws farther win the game. Aha, of course, there are some naughty boys who care

2013 ACM-ICPC长沙赛区全国邀请赛——Travel in time

题目链接 题意: 给n个点,m条边的无向图,一个起点和一个终点.每边都有消耗,经过就要付出代价:每个点有消耗和价值,只有消耗了才会获得价值,如果不消耗就不会获得价值,且下一次消耗的点的价值一定要严格大于之前消耗过的点的价值 求:起点到终点消耗不超过给定值T时的价值最大值 1 < N < 100,0 < M < 1000,0 < T <= 300 分析: 对于不进行点的消耗的操作,就是求两点的最短路,floyd求 表示一下状态: 可以粗率表示为:当前所在点.总消耗值.总价

hduoj 4710 Balls Rearrangement 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4710 Balls Rearrangement Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 735    Accepted Submission(s): 305 Problem Description Bob has N balls and A b

hduoj 4708 Rotation Lock Puzzle 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4708 Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Alice was felling into a cave. She found a strange door with a number square m

2013 ACM/ICPC Asia Regional Chengdu Online

题目链接: 2013 ACM/ICPC Asia Regional Chengdu Online 上年网选被虐得好惨,遂决定把题目拿回来搞一遍, 不会的题补之! A. 2013 ACM/ICPC Asia Regional Chengdu Online,布布扣,bubuko.com

2013 ACM/ICPC 长沙现场赛 A题 - Alice&#39;s Print Service (ZOJ 3726)

Alice's Print Service Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her print service found some tricks to save money. For example, the price when

2013ACM-ICPC杭州赛区全国邀请赛——Random Walk

题目链接 题意: n个点,按照题中给的公式可以求出任意两个点转移的概率.求从1到n的期望转移次数 分析: 设dp[i]为从i到n的期望,那么可以得到公式dp[i] = sigma(dp[i + j] * p(i + j, i)),1 <= j <= m 把这个式子展开来:dp[i - m] * p(i - m, i) + dp[i - m + 1] * dp(i - m + 1, i) + ... + dp[i] * p(i, i) + ... + dp[i + m] * p(i + m, i

hduoj 4706 Herding 2013 ACM/ICPC Asia Regional Online —— Warmup

hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup Herding Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2005    Accepted Submission(s): 563 Problem Description Little Joh

hduoj 4706 Children&amp;#39;s Day 2013 ACM/ICPC Asia Regional Online —— Warmup

http://acm.hdu.edu.cn/showproblem.php?pid=4706 Children's Day Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others) Problem Description Today is Children's Day. Some children ask you to output a big letter 'N'. 'N' is c