| ||||||||||
| 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 | |||||||||
怎么会WA掉?#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
int yyyy,mm,dd,hh,mmx,ss;
bool f=true;
scanf("%d/%d/%d-%d:%d:%d",&yyyy,&mm,&dd,&hh,&mmx,&ss);
if(mm<10)
cout<<"0";
cout<<mm<<"/";
if(dd<10)
cout<<"0";
cout<<dd<<"/"<<yyyy<<"-";
if(hh>12)
{
if(hh<=21)
cout<<"0";
cout<<hh-12<<":";
f=false;
if(hh==24)
f=true;
}
else
{
if(hh==12)
cout<<hh<<":";
else
{
if(hh==0)
cout<<"12:";
else
cout<<"0"<<hh<<":";
}
}
if(mmx<10)
cout<<"0";
cout<<mmx<<":";
if(ss<10)
cout<<"0";
cout<<ss<<(f?"am":"pm")<<"\n";
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator