http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2160
中譯
http://luckycat.kshs.kh.edu.tw/homework/q11219.htm
#include "stdio.h" int main() { int T,D,M,Y,d,m,y,DAYS,days,times = 1; scanf(" %d",&T); while ( times <= T ) { scanf(" %d/%d/%d",&D,&M,&Y); scanf(" %d/%d/%d",&d,&m,&y); DAYS = Y * 12 * 31 + (M - 1) * 31 + D; days = y * 12 * 31 + (m - 1) * 31 + d; if( DAYS - days < 0) printf("Case #%d: Invalid birth date\n",times); else if( DAYS - days >= 131 * 12 * 31 ) printf("Case #%d: Check birth date\n",times); else { printf("Case #%d: %d\n",times,(DAYS - days) / (12 * 31)); } times++; } return 0; }
沒有留言:
張貼留言