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 }
  • 相关阅读:
    js 面试的坑:变量提升
    meta 标签大全
    一个极为简单的requirejs实现
    AMD 的 CommonJS wrapping
    浅解析js中的对象
    javascript运动系列第二篇——变速运动
    开发汉澳即时通信网,2006年上线,QQ死期到了
    SpringMVC中的异步提交表单
    HDU 3698 DP+线段树
    黑马程序猿_反射、内省、泛型
  • 原文地址:https://www.cnblogs.com/cszlg/p/2912822.html
Copyright © 2011-2022 走看看