Gym 100952A&&2015 HIAST Collegiate Programming Contest A. Who is the winner?【字符串,暴力】
2017-07-24 07:12
501 查看
A. Who is the winner?
time limit per test:1 secondmemory limit per test:64 megabytes
input:standard input
output:standard output
A big marathon is held on Al-Maza Road, Damascus. Runners came from all over the world to run all the way along the road in this big marathon day. The winner is the player who crosses the finish line first.
The organizers write down finish line crossing time for each player. After the end of the marathon, they had a doubt between 2 possible winners named "Player1" and "Player2". They will give you the crossing time for those players and they want you to say who is the winner?
Input
First line contains number of test cases (1 ≤ T ≤ 100). Each of the next T lines represents one test case with 6 integers H1 M1 S1 H2 M2 S2. Where H1, M1, S1 represent Player1 crossing time (hours, minutes, seconds) and H2, M2, S2 represent Player2 crossing time (hours, minutes, seconds). You can assume that Player1 and Player2 crossing times are on the same day and they are represented in 24 hours format(0 ≤ H1,H2 ≤ 23 and 0 ≤ M1,M2,S1,S2 ≤ 59)
H1, M1, S1, H2, M2 and S2 will be represented by exactly 2 digits (leading zeros if necessary).
Output
For each test case, you should print one line containing "Player1" if Player1 is the winner, "Player2" if Player2 is the winner or "Tie" if there is a tie.
Examples
Input
3 18 03 04 14 03 05 09 45 33 12 03 01 06 36 03 06 36 03
Output
Player2 Player1 Tie
题目链接:http://codeforces.com/gym/100952/problem/A
题意:给定两组时间,包括时:分:秒三种信息,比较求解两组时间哪一个最短!
分析:直接做,忽略前导0,直接输入整数就好,当时以为是字符串输入,搞了半天都出不来!
下面给出AC代码:
#include <bits/stdc++.h> using namespace std; typedef long long ll; inline int read() { int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); } return x*f; } inline void write(int x) { if(x<0) { putchar('-'); x=-x; } if(x>9) { write(x/10); } putchar(x%10+'0'); } int a[3],b[3]; int n; int main() { n=read(); while(n--) { //cin.getline(s1,8); //cin.getline(s2,8); for(int i=0;i<3;i++) a[i]=read(); for(int i=0;i<3;i++) b[i]=read(); int flag=-1; for(int i=0;i<3;i++) { if(a[i]>b[i]) { flag=1; break; } else if(a[i]<b[i]) { flag=0; break; } else continue; } if(flag==1) printf("Player2\n"); else if(flag==0) printf("Player1\n"); else printf("Tie\n"); } return 0; }
相关文章推荐
- CodeForces-2015 HIAST Collegiate Programming Contest-Gym-100952A-Who is the winner?
- Gym 100952C&&2015 HIAST Collegiate Programming Contest C. Palindrome Again !!【字符串,模拟】
- Gym 100952G&&2015 HIAST Collegiate Programming Contest G. The jar of divisors【简单博弈】
- Gym 100952E&&2015 HIAST Collegiate Programming Contest E. Arrange Teams【DFS+剪枝】
- Gym 100952D&&2015 HIAST Collegiate Programming Contest D. Time to go back【杨辉三角预处理,组合数,dp】
- Gym 100952H&&2015 HIAST Collegiate Programming Contest H. Special Palindrome【dp预处理+矩阵快速幂/打表解法】
- Gym 100952I&&2015 HIAST Collegiate Programming Contest I. Mancala【模拟】
- Gym 100952J&&2015 HIAST Collegiate Programming Contest J. Polygons Intersection【计算几何求解两个凸多边形的相交面积板子题】
- Gym 100952B&&2015 HIAST Collegiate Programming Contest B. New Job【模拟】
- Gym 100952F&&2015 HIAST Collegiate Programming Contest F. Contestants Ranking【BFS+STL乱搞(map+vector)+优先队列】
- The7th Zhejiang Provincial Collegiate Programming Contest->Problem A:A - Who is Older?
- Sudoku - The 2015 China Collegiate Programming Contest && UESTC 1222
- CodeForces-2015 HIAST Collegiate Programming Contest-Gym-100952A.水题 100952B.水题 100952C.回文字符串 100952D.杨辉三角处理组合数 其他题目待续。。。
- 【Gym 100712A】Who Is The Winner?
- The 2015 China Collegiate Programming Contest D Pick The Sticks
- Gym 100952 A. Who is the winner?
- The 7th Zhejiang Provincial Collegiate Programming Contest->Problem B:B - Somali Pirates
- The 2015 China Collegiate Programming Contest K Game Rooms hdu 5550
- 2015-2016 ACM-ICPC Nordic Collegiate Programming Contest (NCPC 2015) Adjoin the Networks (树的直径)
- The 7th Zhejiang Provincial Collegiate Programming Contest->Problem G:G - Wu Xing