Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怎么会WA掉?

Posted by twd2 at 2010-07-25 12:51:30 on Problem 3751
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator