Pages: 68/85 First page Previous page 63 64 65 66 67 68 69 70 71 72 Next page Final page [ View by Articles | List ]

再来猜礼物喽~~

| August 16, 2007 19:17 | timmy | Via Original
Open in new window
可乐瓶是参照物

提示:玩的
再提示:小朋友玩的

猜对无奖~grin
Tags:

猜猜什么东东哈~~

| August 15, 2007 22:09 | timmy | Via Original
Open in new window
猜对无奖~~

Open in new window
更新一下哈,中间的可乐瓶是参照物。
Tags:

傻乎乎的帮人翻译了两题NOI竞赛题

| August 14, 2007 14:07 | timmy | Via Original
     中午某群里突然蹦出一题全英文的NOI竞赛题,是个小MM,求翻译。本着帮助小学妹的心态,我仔细读了几遍,并逐句翻译了下来。自己当年参加NOI不成功,也该帮助后人嘛。谁知道一题过后,又来一题,只好再静下心来继续翻。最后真相大白,她并不参加NOI,求翻译只是去为了与另一个人换作业。--|||
     有点被人卖了的感觉。
   爱常说:你总是对女孩子很好。
   梦露说:你对A这么好,你能不能对自己好点?
   敏敏也说:你对A太好了,你对女孩子都这么好吗?
   对人好,反过来受伤的又是自己。我错了么?

calculating the taxi fares

| August 14, 2007 13:42 | timmy | Via Original
The rules for calculating the taxi fares are quite complex. Many factors are to be considered in computing the taxi fares, including the length of the trip, the time of the day, the speed, etc. Every morning Bianca Bennett uses taxi to get to her office, she thinks if taximeters are programmed correctly. One day, she decided to write a program to calculate the taxi fares to check this.

Imagine a taxi passes through a sequence of streets S1, S2, ..., Sn in order. The length of Si is Li and it is assumed that the taxi travels in a constant speed and it takes Mi minutes to travel one kilometer in Si. To make it simple, assume the passenger gets in at the start of a street Si and gets out at the end of the destination street Sj (i.e., he does not get in or out in the middle of a street). The passenger is charged for each kilometer of the trip. The first ten kilometers of the trip cost 1000 Rials each. The next 20 kilometers (from 11 to 30) cost 250 Rials each. After that, each kilometer costs 100 Rials

During the night, the fare is increased by 20%. The rule is that for each kilometer, if the taxi travels at least one minute during the time interval [12 AM, 6 AM], that kilometer will cost 20% more. Since driving in a heavy traffic costs more, if the average speed of the taxi is less than 30 km/h during the whole trip, the fare is increased by 10%.

The input consists of multiple test cases. The first part of each test case is the sequence of streets the taxi travels. This comes in several lines, each describing one street in the form of street-name length min. street-name is a unique string of at most 20 letters and digits with no blank in it, and length and min are two positive integer numbers which are Li; (measured in kilometers, at most 200) and Mi (measured in minutes) respectively. Each street is visited once by the taxi. The first part of the test case is terminated by a line containing a single $ character. The second part of the test case contains a single line of the form source-street dest-street time. The first two items are the names of the source and the destination streets respectively. The third item is the time the passenger gets in which is in standard 24-hours format (HH:MM). There is a line containing a single # character at the end of each test case. You may assume that the source and the destination streets belong to the input sequence of streets and the destination street does not come before the source street. The last line of the input contains two dash characters as shown in the sample input.

出租车费用的计算程序是相当复杂的。计算出租车费用,许多因素要被考虑,包括旅程长度,一天里面的时间段,速度等等。每天早晨Bianca Bennett打的到她的办公室,她在考虑车费指示器的程序是否正确。一天,她决定写一段程序来计算出租车费来检验一下。

假设一辆出租车驶过一系列有先后顺序的街道S1,S2,...Sn。Si的长度是Li,假设出租车以匀速驶过,并且在Si中每行驶一公里要花费Mi分钟。打个比方,假设乘客在Si的端点处上车,并在街道Sj的末端下车(中途并没有逗留)。该乘客为这次trip付钱。第一个10公里为每公里1000里亚尔(伊朗的银币)。接下来的20公里(即从11到30)为每公里250里亚尔。再接下来就以每公里100里亚尔计费。

在夜间,费用增加了20%。计费规则是如果该出租车在6AM到12AM这个时间段内行驶超过一分钟,那每公里要涨价20%。因为在交通拥挤时行驶要花费更多,如果全程的平均速度低于30km/h,费用将增加10%。

输入部分由多重检测条件组成。每一项检测条件的第一部分是出租车行驶过的街道的序列。这要分成数行,每一行以“街道名称 长度 行驶时间”这一格式来描述。街道名称是一段包含最多20个字母和数字并无空格的唯一字符串,长度和行驶时间是两个正整数,分别是Li(按公里计算,最大200)和Mi(以分钟计算)。每一条街道被出租车访问一次。检测条件的第一部分以一行包含$的字符结束。检测条件的第二部分只包含一行,格式为“起点街道 终点街道 时间”。前两个元素分别是起点街道和终点街道的名称,第三个元素是乘客上车的时间,为标准的24小时制格式。每一项检测条件的最后都以包含一个$字符的一行作为中止符号。你可以假设起点街道和中止街道属于输入的序列街道,并且中止街道不能在起点街道前面。输入的最后一行包含与输入例中一样的两个破折号。

wild number

| August 14, 2007 13:41 | timmy | Via Original
A wild number is a string containing digits and question marks (like 36?1?8). A number X matches a wild number W if they have the same length, and every non-question mark character in X is equal to the character in the same position in W (it means that you can replace a question mark with any digit). For example, 365198 matches the wild number 36?1?8, but 360199, 361028, or 36128 does not. Write a program that reads a wild number W and a number X from input, both of length n, and determines the number of n-digit numbers that match W and are greater than X.

There are multiple   cases in the input. Each test case consists of two lines of the same length. The first line contains a wild number W, and the second line contains an integer number X. The length of input lines is between 1 and 10 characters. The last line of input contains a single character #.

For each test case, write a single line containing the number of n-digit numbers matching W and greater than X (n is the length of W and X).


Sample Input


36?1?8
236428
8?3
910
?
5
#


Sample Output


100
0
4


一个wild number(这个不知道怎么翻)是一串包含数字和问号的字符串。一个数字X与一个wild number W有相同的长度,而且每一个非问号位上的字符都相同,那么这两个字符串相互匹配(就是说你可以将问号替换成任意的数字)。例如,365198与wild number字符串36?1?8相匹配,但是360199,361028和36128都不与此匹配。写一段程序,读入一串wild number字符和一个数字X,长度都为n,并求出这些与W匹配的n位数字中比X大的数字。

输入部分有多重检测条件。每一项检测条件由相同长度的两行组成。第一行包含一个wild number W,第二行包含一个整数X。输入的字符的长度为1到10字符。最后一行包含单一的一个字符#。

对于每一个检测项,输出一行,包含n位数字中与W相匹配并比X大的数。
Pages: 68/85 First page Previous page 63 64 65 66 67 68 69 70 71 72 Next page Final page [ View by Articles | List ]