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("Player2n");
64 else if(flag==0)
65 printf("Player1n");
66 else printf("Tien");
67 }
68 return 0;
69 }
- 从零开始的Spring Session(二)
- [汇总]2013年度全球重、特大网络安全事件回顾
- android常用接口(一)
- 2014密码时代已死?六种旨在取代传统密码位置的新奇想法
- 程序员你为什么这么累【续】:编码习惯之配置规范
- Spring Security (一) Architecture Overview
- Spring Security (二) Guides
- 一个 android 的框架
- Spring Cloud实战小贴士:Ribbon的饥饿加载(eager-load)模式
- android常用接口(二)
- Spring Cloud实战小贴士:Zuul的饥饿加载(eager-load)使用
- RxAndroid完全教程
- 全能型反汇编引擎 – Capstone-Engine
- Hijack攻击揭秘
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- AtCoder Beginner Contest 165 A ~~D
- 离散化思想详细讲解
- AtCoder Beginner Contest 164---D
- 问题 1511: [蓝桥杯][算法提高VIP]复数求和
- 计算机网络--概论
- 因式分解(计蒜网)
- 区间合并(计蒜网)
- AtCoder Beginner Contest 161 A~~F
- 试题 算法训练 猴子吃包子
- 蓝桥杯 试题 基础练习 字符串对比
- 蓝桥杯 试题 基础练习 矩阵乘法
- 蓝桥杯 试题 基础练习 矩形面积交
- 蓝桥杯 试题 基础练习 完美的代价(详细c++)
- 牛客小白月赛23 部分题解
- AtCoder Beginner Contest 159 A~~D