ZOJ 3322 Who is Older?.
来源:互联网 发布:thinking in java在线 编辑:程序博客网 时间:2024/05/16 01:34
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
====
一道水题,不知不觉涨了好多姿势。
判断时间,日期这种题,直接用字符串比较就行了。
#include<stdio.h>#include<string.h>int main(){ int t; scanf("%d\n",&t); //注意\n while(t--) { char s[30]; gets(s); s[10]=0; //== s[10]='\0'; int ok=strcmp(s,s+11); //注意strcmp函数,遇到'\0'直接结束比较。 if(ok>0) puts("cpcs"); else if(ok<0) puts("javaman"); else puts("same"); } return 0;}
0 0
- ZOJ 3322 Who is Older?.
- ZOJ 3322Who is Older?
- ZOJ 3322 Who is Older?
- ZOJ 3322 Who is Older?
- ZOJ 3322Who is Older?
- ZOJ 3322Who is Older?(模拟)
- ZOJ 省赛题 Who is Older?
- ZOJ-3322-Who is Older?【7th浙江省赛】
- ZOJ 3333 Guess the Price 3323 Somali Pirates 3322 Who is Older?(超级水)
- ZOJ3322-Who is Older?
- A. Who is Older?
- 周赛问题 福州 A - Who is Older?
- zoj 3519 Who is the Smartest Man
- zoj 3519 Who is the Smartest Man
- 2014ACM集训13级PK赛2-Who is Older?
- The7th Zhejiang Provincial Collegiate Programming Contest->Problem A:A - Who is Older?
- The7th Zhejiang Provincial Collegiate Programming Contest->Problem A:A - Who is Older?
- ZOJ 3519 Who is the Smartest Man(贪心)
- mysql常用
- 枚举类型的组合
- tnsnames.ora配制文件
- Hadoop2中的日志
- 线段树算法 ---- 扫描线之面积并
- ZOJ 3322 Who is Older?.
- 最全的Android开发资源整理--进阶必备
- ZF2搭建
- OCP 1Z0 053 33
- mac 卸载mysql,
- <button>的onmoseovert js事件改变this.src地址失败
- struts2源码解析一 Struts2 日记原理及配置方法
- linux下非阻塞的tcp研究
- 看看名人们是怎么说会计的~~