Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
读入数据可以这样写:scanf("%d/%d/%d-%d:%d:%d",&year,&month,&day,&hour,&minute,&second);RT。 贴个code? #include <iostream> using namespace std; int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int i,N; int year,month,day,hour,minute,second; cin>>N; for(i=0;i<N;i++) { scanf("%d/%d/%d-%d:%d:%d",&year,&month,&day,&hour,&minute,&second); printf("%02d/%02d/%04d-",month,day,year); if(hour == 12) printf("12:%02d:%02dpm\n",minute,second); else if(hour == 0) printf("12:%02d:%02dam\n",minute,second); else if(hour > 12) printf("%02d:%02d:%02dpm\n",hour-12,minute,second); else printf("%02d:%02d:%02dam\n",hour,minute,second); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator