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
简单题,比大小#include<map>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ms(x,y) memset(x,y,sizeof(x))
#define rep(i,j,k) for(int i=j;i<=k;i++)
#define per(i,j,k) for(int i=j;i>=k;i--)
#define loop(i,j,k) for (int i=j;i!=-1;i=k[i])
#define inone(x) scanf("%d",&x)
#define intwo(x,y) scanf("%d%d",&x,&y)
#define inthr(x,y,z) scanf("%d%d%d",&x,&y,&z)
typedef long long LL;
const int low(int x) { return x&-x; }
const int mod = 1e9 + 7;
const int N = 310;
const int M = 1 << 14;
int T, a[N], b[N];
int check()
{
rep(i, 0, 2)
{
if (a[i] == b[i]) continue;
return a[i] < b[i] ? 1 : -1;
}
return 0;
}
int main()
{
for (inone(T); T--;)
{
rep(i, 0, 2) inone(a[i]);
rep(i, 0, 2) inone(b[i]);
switch (check())
{
case 1:puts("javaman"); break;
case 0:puts("same"); break;
case -1:puts("cpcs"); break;
default:break;
}
}
return 0;
}
Javaman and cpcs are arguing who is older. Write a program to help them.
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.
For each test case, output who is older in a single line. If they have the same birthday, output "same" (without quotes) instead.
3 1983 06 06 1984 05 02 1983 05 07 1980 02 29 1991 01 01 1991 01 01
javaman cpcs same
简单题,比大小#include<map> #include<cmath> #include<queue> #include<vector> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define ms(x,y) memset(x,y,sizeof(x)) #define rep(i,j,k) for(int i=j;i<=k;i++) #define per(i,j,k) for(int i=j;i>=k;i--) #define loop(i,j,k) for (int i=j;i!=-1;i=k[i]) #define inone(x) scanf("%d",&x) #define intwo(x,y) scanf("%d%d",&x,&y) #define inthr(x,y,z) scanf("%d%d%d",&x,&y,&z) typedef long long LL; const int low(int x) { return x&-x; } const int mod = 1e9 + 7; const int N = 310; const int M = 1 << 14; int T, a[N], b[N]; int check() { rep(i, 0, 2) { if (a[i] == b[i]) continue; return a[i] < b[i] ? 1 : -1; } return 0; } int main() { for (inone(T); T--;) { rep(i, 0, 2) inone(a[i]); rep(i, 0, 2) inone(b[i]); switch (check()) { case 1:puts("javaman"); break; case 0:puts("same"); break; case -1:puts("cpcs"); break; default:break; } } return 0; }