Who is Older?(水题)

Who is Older?

Time Limit: 1 Second      Memory Limit: 32768 KB

Javaman and cpcs are arguing who is older. Write a program to help them.

Input

There are multiple test cases. The first line of input is an integer T (0 < T <= 1000) indicating the number of test cases. Then T test cases follow. The i-th line of the next T lines contains two dates, the birthday of javaman and the birthday of cpcs. The format of the date is "yyyy mm dd". You may assume the birthdays are both valid.

Output

For each test case, output who is older in a single line. If they have the same birthday, output "same" (without quotes) instead.

Sample Input

3
1983 06 06 1984 05 02
1983 05 07 1980 02 29
1991 01 01 1991 01 01

Sample Output

javaman
cpcs
same

 1 #include <iostream>
 2 #include <cstdio>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int t, x[3], y[3], tag;
 9     cin >> t;
10     while(t--)
11     {
12         cin >> x[0] >> x[1] >> x[2] >> y[0] >> y[1] >> y[2];
13         if(x[0] > y[0]) tag = 1;
14         else if(x[0] < y[0]) tag = -1;
15         else
16         {
17             if(x[1] > y[1]) tag = 1;
18             else if(x[1] < y[1]) tag = -1;
19             else
20             {
21                 if(x[2] > y[2]) tag = 1;
22                 else if(x[2] < y[2]) tag = -1;
23                 else tag = 0;
24             }
25         }
26         if(tag > 0) puts("cpcs");
27         else if(tag < 0) puts("javaman");
28         else puts("same");
29     } 
30     return 0;
31 }
原文地址:https://www.cnblogs.com/cszlg/p/2912822.html