POJ 2840 Big Clock

简介: DescriptionOur vicar raised money to have the church clock repaired for several weeks. The big clock, which used to strike the hours days...

Description

Our vicar raised money to have the church clock repaired for several weeks. The big clock, which used to strike the hours days and nights, was damaged several weeks ago and had been silent since then.

After the clock was repaired, it works all right, but there is still something wrong with it: the clock will strike thirteen times at one o’clock, fourteen times at two o’clock… 24 times at 12:00, 1 time at 13:00…

How many times will it strike now?
Input

The first line consists of only one integer T (T <= 30), representing the number of test cases. Then T cases follow.

Each test case consists of only one line, representing the time now. Each line includes 2 integers H, M separated by a symbol “:”. (0 <= H < 24, 0 <= M < 60)
Output

For each test case, output the answer in one line.
Sample Input

3
1:00
01:01
00:00
Sample Output

13
0
12

水题,如果分钟不为0,就输出0就ok;
01:00和1:00是一样的;

#include <stdio.h>
#include <stdlib.h>
int main()
{
    int t;
    int a,b;
    scanf("%d",&t);
    while(t--){
        scanf("%d:%d",&a,&b);
        if(b!=0){
            printf("0\n");
            continue;
        }
        if(a>=0&&a<=12){
            printf("%d\n",(a+12)%25);
        }
        if(a>12){
           printf("%d\n",(a+12)%24);
        }
    }
    return 0;
}
目录
相关文章
|
Java
hdu1209 Clock
hdu1209 Clock
48 0
hdu 1196 Lowest Bit(水题)
hdu 1196 Lowest Bit(水题)
48 0
codeforces 339 D.Xenia and Bit Operations(线段树)
输入n,m表示有2^n个数和m个更新,每次更新只把p位置的值改成b,然后输出整个序列运算后的值,而这个运算就比较复杂了, 最下面一层两个数字之间或运算得到原来数目一半的数字,然后两个之间异或运算,得到一半,再或再异或………………,一直到得到一个数字,这个数字就是要求的结果。
58 0
Light oj 1080 - Binary Simulation(树状数组区间更新点查询)
有一字符串只包含0和1,然后又m组操作,I L R是将从L到R的字符进行翻转操作0变为1、1变为0,Q x表示询问第x的字符。
45 0
|
索引
Leetcode-Medium 6. ZigZag Conversion
Leetcode-Medium 6. ZigZag Conversion
98 0
Leetcode-Medium 6. ZigZag Conversion
|
C++
Leetcode-Medium 338. Counting Bits
Leetcode-Medium 338. Counting Bits
104 0
POJ 2840 Big Clock
POJ 2840 Big Clock
116 0
|
机器学习/深度学习
POJ 1423 Big Number
POJ 1423 Big Number
106 0
HDOJ 1196 Lowest Bit(二进制相关的简单题)
HDOJ 1196 Lowest Bit(二进制相关的简单题)
111 0