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

哎,大家注意+12用24取模的时候,12这个数啊,代码如下,提交三次才通过

Posted by jinian_08 at 2011-08-03 11:39:17 on Problem 2840
#include<stdio.h>

int main(void)
{
 //   freopen("in.txt","r",stdin);
    int n, hour, minute, stimes;
    char c;
    scanf("%d", &n);
    while(n--){
        scanf("%d%c%d", &hour, &c, &minute);
        if(minute!=0)
            stimes = 0;
        else if(hour==12)
            stimes = 24;
        else
            stimes = (hour+12)%24;
        printf("%d\n", stimes);
    }
    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