UVA10683 The decadary watch【Ad Hoc】

In the first years following the French Revolution, intellectuals were set to outroot the society from the traditions and superstitions the dark ages of the royalty. Some of these contributions have had a worldwide success, such as the metric system. Others have falled into (almost) complete oblivion, such as the decimal clock system, invented by the mathematician Gilbert Romme. The decimal clock system divides the day in 10 decimal hours, themselves divided in 100 decimal minutes, themselves divided into 100 decimal seconds.
    You are commissioned by the international watch maker “Splatch” to include yet another useless feature in their next line of product: decimal time display. Your first task will be to implement a program that converts a traditional time into a decimal time at the precision of one-hundredth of second.
Input
The input consists of a sequence of lines, each containing exactly one traditional time, in the format HHMMSSCC, where 0 ≤ HH ≤ 23, 0 ≤ MM ≤ 59, 0 ≤ SS ≤ 59 and 0 ≤ CC ≤ 99. The input is terminated with an end-of-file.
Output
For each given traditional time, the output will echo a line with the corresponding decimal time, rounded by truncation, in the format HMMSSCC, where 0 ≤ H ≤ 9, 0 ≤ MM ≤ 99, 0 ≤ SS ≤ 99 and 0 ≤ CC ≤ 99.
Sample Input
00000000
23595999
12000000
14273467
02475901
Sample Output
0000000
9999998
5000000
6024846
1166552

问题链接UVA10683 The decadary watch
问题简述:(略)
问题分析
    将24小时制时间转化成10进制时间。
    简单题不解释。数据输入格式值得推荐。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA10683 The decadary watch */

#include <bits/stdc++.h>

using namespace std;

const double RATE = 10000000.0 / (24 * 3600 * 100);

int main()
{
    int hh, mm, ss, cc;
    while(~scanf("%2d%2d%2d%2d", &hh, &mm, &ss, &cc))
        printf("%07d\n", (int)((((hh * 60 + mm) * 60 + ss) * 100 + cc) * RATE));

    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值