码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-08-31 11:59:21      阅读:383      评论:0      收藏:0      [点我收藏+]

标签:des   http   color   os   io   java   ar   for   art   

题目链接: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;
}


 

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

标签:des   http   color   os   io   java   ar   for   art   

原文地址:http://blog.csdn.net/yuanchang_best/article/details/38958689

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!