ZOJ3322-Who is Older?

来源:互联网 发布:java 字符串 == 编辑:程序博客网 时间:2024/05/18 03:52

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

31983 06 06 1984 05 021983 05 07 1980 02 291991 01 01 1991 01 01

Sample Output

javamancpcssame

Author: CAO, Peng
Source: The 7th Zhejiang Provincial Collegiate Programming Contest


题意:告诉你两个人的出生日期,问两个人谁更大,一样则输出same


#include <iostream>#include <cstdio>using namespace std;#define LL long longconst int INF=0x3f3f3f3f;const int MAX=100009;int y1,y2,d1,d2,r1,r2;int main(){    int t;    scanf("%d",&t);    while(t--)    {        scanf("%d %d %d %d %d %d",&y1,&d1,&r1,&y2,&d2,&r2);        if(y1==y2&&d1==d2&&r1==r2) printf("same\n");        else if(y1==y2)        {            if(d1==d2)            {                if(r1>r2) printf("cpcs\n");                else printf("javaman\n");            }            else            {                if(d1>d2) printf("cpcs\n");                else printf("javaman\n");            }        }        else if(y1>y2) printf("cpcs\n");        else printf("javaman\n");    }    return 0;}

0 0
原创粉丝点击