zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    学习git之路--1
    No input file specified. phpStudy nginx报错解决方案
    nginx隐藏tp路由index.php
    tp5命令行
    生成器
    php 解密小程序获取unionid
    根据GUID获取实例
    用SQL将数字转换为中文数字
    TFS无法确定工作区解决方案
    利用SQL语句产生分组序号
  • 原文地址:https://www.cnblogs.com/cszlg/p/2912822.html
Copyright © 2011-2022 走看看