Who is Older?(水题)
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 }
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步