博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Gym 100952A&&2015 HIAST Collegiate Programming Contest A. Who is the winner?【字符串,暴力】
阅读量:7110 次
发布时间:2019-06-28

本文共 2551 字,大约阅读时间需要 8 分钟。

A. Who is the winner?

time limit per test:1 second
memory 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

题目链接:
题意:给定两组时间,包括时:分:秒三种信息,比较求解两组时间哪一个最短!
分析:直接做,忽略前导0,直接输入整数就好,当时以为是字符串输入,搞了半天都出不来!
下面给出AC代码:
1 #include 
2 using namespace std; 3 typedef long long ll; 4 inline int read() 5 { 6 int x=0,f=1; 7 char ch=getchar(); 8 while(ch<'0'||ch>'9') 9 {10 if(ch=='-')11 f=-1;12 ch=getchar();13 }14 while(ch>='0'&&ch<='9')15 {16 x=x*10+ch-'0';17 ch=getchar();18 }19 return x*f;20 }21 inline void write(int x)22 {23 if(x<0)24 {25 putchar('-');26 x=-x;27 }28 if(x>9)29 {30 write(x/10);31 }32 putchar(x%10+'0');33 }34 int a[3],b[3];35 int n;36 int main()37 {38 n=read();39 while(n--)40 {41 //cin.getline(s1,8);42 //cin.getline(s2,8);43 for(int i=0;i<3;i++)44 a[i]=read();45 for(int i=0;i<3;i++)46 b[i]=read();47 int flag=-1;48 for(int i=0;i<3;i++)49 {50 if(a[i]>b[i])51 {52 flag=1;53 break;54 }55 else if(a[i]

 

转载地址:http://ncthl.baihongyu.com/

你可能感兴趣的文章
PHP编写一些检查项函数
查看>>
笨鸟先飞学编程系列之二 基础代码的编写2(转)
查看>>
samza快速理解
查看>>
spark streaming容错机制
查看>>
空间和数据库存储的区别是什么
查看>>
我的友情链接
查看>>
新站不带www域名显露出来当天快照
查看>>
[图灵程序设计丛书].高效算法:竞赛、应试与提高必修128例.pdf
查看>>
二叉树的实现及其可视化
查看>>
Android流行样式书签
查看>>
Servlet详解
查看>>
Ext 表单与输入控件 下拉框
查看>>
CentOS 6 启动流程
查看>>
第二个python爬虫 多页面抓取美女图片
查看>>
jpa多数据源配置参考链接
查看>>
Linux学习日志之Linux常用命令总结
查看>>
Spring AOP: Spring之面向方面编程
查看>>
记录:使用IDEA编辑Spring配置文件profile属性时产生的命名重复问题
查看>>
VB为报表GridReport设定显示时间
查看>>
VCenter的经验教训-为了偷懒5分钟结果花了一天的时间来查错
查看>>