1144. Who is Older?

  1. Who is Older?
    时间限制:1Sec内存限制:128MB通过:57提交:101

题目描述

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<bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    int a[1005],b[1005],c[1005];
    while(~scanf("%d",&x))
    {
        while(x--)
    {
       for(int j=0;j<2;j++)
        {
            cin>>a[j];
            cin>>b[j];
            cin>>c[j];
        }
        int i=0;
        if(a[i]>a[i+1])
        {
            cout<<"javaman"<<endl;

        }
        else if(a[i]<a[i+1])
        {
            cout<<"cpcs"<<endl;
        }
        else if(a[i]==a[i+1])
        {
            if(b[i]>b[i+1])
        {
            cout<<"javaman"<<endl;

        }
        else if(b[i]<b[i+1])
        {
            cout<<"cpcs"<<endl;

        }
        else if(b[i]==b[i+1])
        {
            if(c[i]>c[i+1])
        {
            cout<<"javaman"<<endl;

        }
        else if(c[i]<c[i+1])
        {
            cout<<"cpcs"<<endl;

        }
        else if(c[i]==c[i+1])
        {
            cout<<"same"<<endl;

        }
        }
        }
    }
    }

}

输出正确,oj失败,有情况没考虑或者题意理解错误。

Guess you like

Origin blog.csdn.net/weixin_52908342/article/details/119782725