| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 678 人关注过本帖
标题:[求助]TIME
只看楼主 加入收藏
zhanghuan_10
Rank: 1
等 级:新手上路
威 望:2
帖 子:751
专家分:0
注 册:2006-10-25
收藏
 问题点数:0 回复次数:2 
[求助]TIME

Time

--------------------------------------------------------------------------------

Time limit: 1sec. Submitted: 72
Memory limit: 32M Accepted: 22

Source : ACM ICPC Central European Regional 1997

--------------------------------------------------------------------------------

Let a time point be given as 6 integers y, m, d, h, min, s where 1970 < y < 2030, 0 < m < 13, 0 < d < 32, 0 <= h < 24, 0 <= min < 60, 0 <= s < 60. Write a program which computes how many periods of a given length fit between two given time points. A period is given by a pair consisting of a positive integer and a word expressing a time unit, i.e. year or month or day or hour or minute or second. Every 4th year is a leap year, except every 100th which is not except every 400 year which is. A length of the year varies according to leap years. The same is true for the month February. Time units always start as usual, e.g., a year starts at 1st January, a month starts at its 1st day, a day starts at 0 hours 0 minutes 0 seconds, etc. A period ends after its last second.

Input

The input consists of blocks of lines. Each block has three lines. The first line of a block contains a time point D1 and the second line a time point D2. D1 always precedes D2. All numbers in the lines are separated by one space. You can assume that the given descriptions of time points are correct. The third line contains a time period. There is one space between the number and the word in the period definition on this line. After each block, there is one empty line.


Output

The output contains the lines corresponding to the blocks in the input. A line corresponding to a block contains one integer number expressing how many specified periods are contained between the given time points.


Sample Input

1997 12 31 23 59 59
1998 1 1 0 0 0
1 second

2000 2 29 0 0 0
2000 2 29 23 59 59
1 day

2000 2 29 0 0 0
2000 3 1 0 0 0
24 hour

1996 12 31 20 30 0
1997 1 1 7 30 0
60 minute

1996 12 31 20 30 0
1997 1 1 7 30 0
1 hour


Sample Output

1
0
1
11
10

做了很久,总是超时!希望大家看一下!

搜索更多相关主题的帖子: TIME 
2006-12-09 12:16
senyee
Rank: 1
等 级:新手上路
帖 子:422
专家分:0
注 册:2006-11-28
收藏
得分:0 

能翻译下吗?


菜鸟~~请多指教~~
2006-12-09 14:20
zhanghuan_10
Rank: 1
等 级:新手上路
威 望:2
帖 子:751
专家分:0
注 册:2006-10-25
收藏
得分:0 
意思就是两行分别代表一个时间点!然后看这两个时间点之间相差的时间是第三行所给的时间的多少倍!还要注意是闰年的时候!

该学习了。。。
2006-12-09 14:48
快速回复:[求助]TIME
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022256 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved