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;
}
目录
相关文章
《深入理解高并发编程(第2版)》八大篇章,共433页,打包发布!!
大家好,我是冰河~~ 在 冰河技术 微信公众号中的【精通高并发系列】专题,更新了不少文章,有些读者反馈说,在公众号中刷历史文章不太方便,有时会忘记自己看到哪一篇了,当打开一篇文章时,似乎之前已经看过了,但就是不知道具体该看哪一篇了。相信很多小伙伴都会有这样的问题。那怎么办呢? 最好的解决方案就是我把这些文章整理成PDF电子书,免费分享给大家,这样,小伙伴们看起来就方便多了。
1295 0
《深入理解高并发编程(第2版)》八大篇章,共433页,打包发布!!
|
10月前
|
存储 数据可视化 API
重磅干货,免费三方网络验证[用户系统+CDK]全套API接口分享教程。
本套网络验证系统提供全面的API接口,支持用户注册、登录、数据查询与修改、留言板管理等功能,适用于不想自建用户系统的APP开发者。系统还包含CDK管理功能,如生成、使用、查询和删除CDK等。支持高自定义性,包括20个自定义字段,满足不同需求。详细接口参数及示例请参考官方文档。
|
SQL 缓存 Java
mybatis 一对多查询
mybatis 一对多查询
277 0
|
存储 分布式计算 Hadoop
Hadoop性能问题
【7月更文挑战第12天】
180 11
|
11月前
|
算法 C++
2022年第十三届蓝桥杯大赛C/C++语言B组省赛题解
2022年第十三届蓝桥杯大赛C/C++语言B组省赛题解
232 5
|
11月前
|
运维 监控 安全
物联网卡:物联网卡为什么不能使用在手机上
物联网卡(IoT SIM卡)通常是为物联网设备设计的,这些设备包括但不限于智能家居设备、可穿戴设备、工业监控设备等。它们与用于智能手机的SIM卡有所不同,主要是因为设计目标、功能限制、资费结构以及网络接入策略上的差异。以下是物联网卡不能直接在手机上使用的主要原因:
|
Linux
Linux下采集摄像头的图像再保存为JPG图片存放到本地(YUYV转JPG)
Linux下采集摄像头的图像再保存为JPG图片存放到本地(YUYV转JPG)
2229 2
Linux下采集摄像头的图像再保存为JPG图片存放到本地(YUYV转JPG)
|
缓存 JavaScript 前端开发
Vue3——Router4教程(小满版本)(二)
Vue3——Router4教程(小满版本)
388 0
|
运维 前端开发 算法
揭秘成熟互联网团队:团队成员包括哪些岗位?
揭秘成熟互联网团队:团队成员包括哪些岗位?
606 0
|
存储 图形学 Android开发
Unity——资产包(Asset Bundles)
Unity——资产包(Asset Bundles)
506 0