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

    1.Link:

    http://poj.org/problem?id=2840

    2.Content:

    Big Clock
    Time Limit: 1000MS   Memory Limit: 131072K
    Total Submissions: 9735   Accepted: 6165

    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
    

    Source

    3.Method:

    4.Code:

     1 #include<iostream>
     2 #include <cstdio>
     3 
     4 using namespace std;
     5 
     6 int main()
     7 {
     8     int i,n;
     9     int a,b;
    10     cin>>n;
    11     for(i=0;i<n;i++)
    12     {
    13         scanf("%d:%d",&a,&b);
    14         if(b!=0) cout<<0<<endl;
    15         else
    16         {
    17             if(a<=12) cout<<(a+12)<<endl;
    18             else cout<<(a-12)<<endl;
    19         }
    20     }
    21     //system("pause");
    22     return 0;
    23 }

    5.Reference:

  • 相关阅读:
    设计模式之Command
    UniversalApp
    swift做服务器端开发
    你不知道的函数floor pow round
    swift开发笔记31
    考试路线
    chrome google mozilla firefox bookmarks import export
    Astah Professional安装
    android studio 安装步骤
    vm安装diagram
  • 原文地址:https://www.cnblogs.com/mobileliker/p/4068279.html
Copyright © 2011-2022 走看看