zoukankan      html  css  js  c++  java
  • POJ 2840 Big Clock

    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
    ");
                continue;
            }
            if(a>=0&&a<=12){
                printf("%d
    ",(a+12)%25);
            }
            if(a>12){
               printf("%d
    ",(a+12)%24);
            }
        }
        return 0;
    }
    
  • 相关阅读:
    关于android示例程序(bitmapfun)——高效加载图片的坑爹地方
    UML笔记
    设计模式>单例模式
    一件很诡异的事CSS
    添加option问题
    a:visited:hover
    电脑出问题了
    邪神呀concat
    关于鼠标中键滚动的问题onmousewheel
    坚强的人
  • 原文地址:https://www.cnblogs.com/webmen/p/5739539.html
Copyright © 2011-2022 走看看