博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDUOJ Metric Time
阅读量:7074 次
发布时间:2019-06-28

本文共 4081 字,大约阅读时间需要 13 分钟。

Metric Time
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 2479   Accepted: 759

Description

The Metric Time is one of the most important points of PSOS Election Programme. The Time can be much easier calculated in operating systems. These systems are then more stable, which meets the main goal of the Party. 
The length of one day is the same as with the "classic" time. The day is divided into 10 metric hours, each of them into 100 metric minutes, and each minute into 100 metric seconds. 10 metric days form one metric week, 10 metric weeks give one metric month, 10 metric months are called metric year. It is obvious this Metric Time is much better than the classic one. 
Some opponent parties often complain that the Metric Time has also some drawbacks. First of all, it would be very difficult to change to the new time. PSOS Chairman decided to solve these problems all at once. He plans to publish a freeware utility which will be able to convert between the time formats. Your goal is to write one half of this utility, the program which converts classic time to Metric Time. Metric hours, metric minutes, and metric seconds are counted starting with zero, as usual. Metric days and metric months start with one. There exist metric year zero. The metric seconds should be rounded to the nearest smaller integer value. Assume that 0:0:0 1.1.2000 classic time is equal to 0:0:0 1.1.0 Metric Time. 
Note that the classic year is leap, if it is an integer multiple of 4. The only exception are years divisible by 100 - they are leap only if they are an integer multiple of 400. For example, leap years are 1996, 2400, and 2000; leap years are not 1900, 2300, 2002. 

Input

At the first line there is a positive integer N stating the number of assignments to follow. Each assignment consists of exactly one line in the form "hour:minute:second day.month.year" which is the date in the classic form (usual in most of European countries). The date is always valid, 2000 <= year <= 50000.

Output

The program must print exactly one line for each assignment. The line should have the form "mhour:mmin:msec mday.mmonth.myear" which is the Metric Time equal to the specified classic time.

Sample Input

70:0:0 1.1.200010:10:10 1.3.20010:12:13 1.3.240023:59:59 31.12.20010:0:1 20.7.74780:20:20 21.7.747815:54:44 2.10.20749

Sample Output

0:0:0 1.1.04:23:72 26.5.00:8:48 58.2.1469:99:98 31.8.00:0:1 100.10.20000:14:12 1.1.20016:63:0 7.3.6848
View Code
1 #include
2 #include
3 #include
4 int monlist[2][14]={
{
0,31,29,31,30,31,30,31,31,30,31,30,31},{
0,31,28,31,30,31,30,31,31,30,31,30,31}}; 5 int leap(int year) 6 { 7 if(((year%4==0)&&(year%100!=0))||(year%400==0)) 8 return 1; 9 return 0;10 }11 long long daysum(int day,int mon,int year)12 {13 long long t=0;14 //printf("%lld",t);//15 int i=0,k;16 int monlist[2][14]={
{
0,31,29,31,30,31,30,31,31,30,31,30,31},{
0,31,28,31,30,31,30,31,31,30,31,30,31}};17 if(year!=2000)18 t+=366+365*(year-1-2000)+(year-1-2000)/4-(year-1-2000)/100+(year-1-2000)/400;19 k=(leap(year)==1)?0:1;20 // printf("i==%d",i);21 //printf("k=%d",k);//22 for(i=mon-1;i>0;i--)23 t+=monlist[k][i];//printf("i==%d",i);24 t+=day;25 //printf("%lld",t);//26 return t-1;27 }28 int main()29 {30 int n;31 int hour,min,sec,day,mon,year;32 int secsum;33 int daysumt;34 scanf("%d",&n);35 while(n--)36 {37 scanf("%d:%d:%d %d.%d.%d",&hour,&min,&sec,&day,&mon,&year);38 secsum=hour*60*60+min*60+sec;39 secsum=(int)(secsum*125.0/108);40 ///printf(" secsum==%lld ",secsum);//41 hour=secsum/10000;42 min=secsum%10000/100;43 sec=secsum%100;44 printf("%d:%d:%d",hour,min,sec);45 daysumt=0;46 daysumt=daysum(day,mon,year);47 //printf(" daysumt==%d ",daysumt);48 day=daysumt%100+1;49 mon=daysumt%1000/100+1;50 year=daysumt/1000;51 printf(" %d.%d.%d\n",day,mon,year);52 }53 return 0;54 }55

转载地址:http://ockml.baihongyu.com/

你可能感兴趣的文章
实现前端MD5加密与记住用户名密码功能
查看>>
command for cut
查看>>
Fortinet安全能力融入华为CloudEPN 联合防御网络威胁
查看>>
使用yum安装MariaDB
查看>>
RHEL7.2配置安装MariaDB数据库
查看>>
百度云管家 v 5.5.0 破解安装版
查看>>
语音识别技术受追捧,无法独立工作的“速记神器”何时才能成为新亮点?
查看>>
对Context的重新思考
查看>>
Win8 Metro(C#)数字图像处理--2.43图像马赛克效果算法
查看>>
顶级MySQL主从复制企业应用
查看>>
nginx访问http80端口跳转https443端口
查看>>
几个必须掌握的css概念:重用、子选择器和组选择器
查看>>
Linux下随机10字符病毒的清除
查看>>
编译安装NTP时间服务报错
查看>>
MongoDB主从
查看>>
iptables防火墙 --Linux详解
查看>>
华为交换机istack堆叠配置
查看>>
wbadmin执行备份命令
查看>>
linux 查看网卡流量的方法
查看>>
DVDROM驱动不能加载的问题
查看>>