第一題 10A
A. Power Consumption Calculation
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes P1 watt
per minute. T1 minutes
after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power consumption changes to P2 watt
per minute. Finally, after T2 minutes
from the start of the screensaver, laptop switches to the "sleep" mode and consumes P3 watt
per minute. If Tom moves the mouse or touches the keyboard when the laptop is in the second or in the third mode, it switches to the first (normal) mode. Tom's work with the laptop can be divided into n time
periods [l1, r1], [l2, r2], ..., [ln, rn].
During each interval Tom continuously moves the mouse and presses buttons on the keyboard. Between the periods Tom stays away from the laptop. Find out the total amount of power consumed by the laptop during the period [l1, rn].
Input
The first line contains 6 integer numbers n, P1, P2, P3, T1, T2 (1 ≤ n ≤ 100, 0 ≤ P1, P2, P3 ≤ 100, 1 ≤ T1, T2 ≤ 60).
The following nlines contain description of Tom's work. Each i-th
of these lines contains two space-separated integers li and ri (0 ≤ li < ri ≤ 1440, ri < li + 1 for i < n),
which stand for the start and the end of the i-th period of work.
Output
Output the answer to the problem.
Sample test(s)
題意:電腦有三種模式,正常模式每分鐘耗電p1,如果沒有使用電腦t1分鐘後變成第二種模式每分鐘耗電p2,如果還是沒有使用電腦t2分鐘後變成第三種模式每分鐘耗電p3。給定n個區間,每一個區間是正常模式,每個區間的間隔是沒有使用,問總的耗電是多少
思路:直接暴力枚舉
代碼:
第二題 11A
A. Increasing Sequence
64 megabytes
A sequence a0, a1, ..., at - 1 is
called increasing if ai - 1 < ai for
each i: 0 < i < t.
You are given a sequence b0, b1, ..., bn - 1 and
a positive integer d. In each move you may choose one element of the given sequence and add d to
it. What is the least number of moves required to make the given sequence increasing?
The first line of the input contains two integer numbers n and d (2 ≤ n ≤ 2000, 1 ≤ d ≤ 106).
The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≤ bi ≤ 106).
Output the minimal number of moves needed to make the sequence increasing.
題意:給定n個數的序列,現在要把這個序列變成遞增的序列,滿足ai < ai+1,現在規定每次可以選擇一個數來增加d,問最少需要幾次
思路:枚舉每一個數求個數即可
第三題 12A
A. Super Agent
2 seconds
There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparing special agent Pearlo for many
years. When, finally, Pearlo learned all secrets of espionage, he penetrated into the Potatoland territory and reached the secret base.
Now he is standing at the entrance, but to get inside he need to pass combination lock. Minute ago one of the workers entered the password on the terminal and opened the door. The terminal is a square digital keyboard 3 × 3 with
digits from 1 to 9.
Pearlo knows that the password consists from distinct digits and is probably symmetric with respect to the central button of the terminal. He has heat sensor which allowed him to detect the digits which the worker pressed. Now he wants to check whether the
password entered by the worker is symmetric with respect to the central button of the terminal. This fact can Help Pearlo to reduce the number of different possible password combinations.
Input contains the matrix of three rows of three symbols each. Symbol «X» means that the corresponding button was pressed, and «.»
means that is was not pressed. The matrix may contain no «X», also it may contain no «.».
Print YES if the password is symmetric with respect to the central button of the terminal and NO otherwise.
Note
If you are not familiar with the term «central symmetry», you may look into http://en.wikipedia.org/wiki/Central_symmetry
題意:給定一個3*3的矩形,每個元素不是X就是.,問這個矩形是否是對稱的
思路:暴力枚舉每一個點,然後判斷每個點是否和它的對稱點都相等即可