Gym 100952A&&2015 HIAST Collegiate Programming Contest A. Who is the winner?【字符串,暴力】

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

题目链接:http://codeforces.com/gym/100952/problem/A

题意:给定两组时间,包括时:分:秒三种信息,比较求解两组时间哪一个最短!

分析:直接做,忽略前导0,直接输入整数就好,当时以为是字符串输入,搞了半天都出不来!

下面给出AC代码:

 1 #include <bits/stdc++.h>
 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]<b[i])
56             {
57                 flag=0;
58                 break;
59             }
60             else continue;
61         }
62         if(flag==1)
63             printf("Player2\n");
64         else if(flag==0)
65             printf("Player1\n");
66         else printf("Tie\n");
67     }
68     return 0;
69 }

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏Aloys的开发之路

一个比较全面的java随机数据生成工具包

        最近,由于一个项目的原因需要使用一些随机数据做测试,于是写了一个随机数据生成工具,ExtraRanom。可以看成是Java官方Random类的扩...

2629
来自专栏小灰灰

Quick-Task 动态脚本支持框架之Groovy脚本加载执行

上一篇简答说了如何判断有任务动态添加、删除或更新,归于一点就是监听文件的变化,判断目录下的Groovy文件是否有新增删除和改变,从而判定是否有任务的变更;

1021
来自专栏Ceph对象存储方案

简谈RGW的index shard计算

在RGW里面每个存储到rados的Object都需要先计算出对应元数据存储的shard number,之后再将元数据信息更新到shard number对应的Ob...

2656
来自专栏UE4技术专场

UE4 ReplicationGraph分析

ReplicationDriverClassName="/Script/ProjectName.ClassName"

4552
来自专栏IT开发技术与工作效率

Excel函数学习重点指南(官网)

1113
来自专栏深度学习自然语言处理

matplotlib--python的数据可视化二

932
来自专栏java系列博客

UML——序列图

2064
来自专栏小文博客

C语言迷宫代码分享

2103
来自专栏吉浦迅科技

TensorFlow版本号升至1.0,正式版即将到来

2015年11月份,谷歌宣布开源了深度学习框架TensorFlow,一年之后,TensorFlow就已经成长为了GitHub上最受欢迎的深度学习框架,尽管那时候...

3629
来自专栏十月梦想

php代码之网站显示安全运行时间代码

上述就可实现网站计时功能,结合数组函数实现,后续可是使用js获取倒计时,时时显示!

1162

扫码关注云+社区