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

新手用C写的。。出来秀一下。。

Posted by thorn at 2011-11-16 16:15:05 on Problem 3751
In Reply To:很短的AC代碼(相信可以去除struct令到更短) Posted by:miklcct at 2011-06-12 21:07:56
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t,y,mon,d,h,min,s,i;
    scanf("%d",&t);
    for(i=0; i<t; i++)
    {
        scanf("%d/%d/%d-%d:%d:%d",&y,&mon,&d,&h,&min,&s);
        if(h>=0&&h<12)
        {
            if(h>=0&&h<1) h=h+12;
            printf("%02d/%02d/%04d-%02d:%02d:%02dam\n",mon,d,y,h,min,s);
        }
        else
        {
            if(h>=13) h=h-12;
            printf("%02d/%02d/%04d-%02d:%02d:%02dpm\n",mon,d,y,h,min,s);
        }
    }

}

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