最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Weekly Contest 2 - UM ICPC Training Group

2022-11-02 17:47 作者:安然Nano  | 我要投稿

A - Chinese Zodiac

The Chinese Zodiac, known as Sheng Xiao, is based on a twelve-year cycle, each year in the cycle related to an animal sign. These signs are the rat, ox, tiger, rabbit, dragon, snake, horse, sheep, monkey, rooster, dog and pig.
Victoria is married to a younger man, but no one knows the real age difference between the couple. The good news is that she told us their Chinese Zodiac signs. Their years of birth in luner calendar is not the same. Here we can guess a very rough estimate of the minimum age difference between them.
If, for instance, the signs of Victoria and her husband are ox and rabbit respectively, the estimate should be?2?years. But if the signs of the couple is the same, the answer should be?12?years.

Input

The first line of input contains an integer?T~(1%5Cle%20T%5Cle%201000)?indicating the number of test cases.
For each test case a line of two strings describes the signs of Victoria and her husband.

Output

For each test case output an integer in a line.

Sample

模擬題。用map代碼量更少。

B - Count Color

Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.
There is a very long board with length L centimeter, L is a positive integer, so we can evenly divide the board into L segments, and they are labeled by 1, 2, ... L from left to right, each is 1 centimeter long. Now we have to color the board - one segment with only one color. We can do following two operations on the board:
1. "C A B C" Color the board from segment A to segment B with color C.
2. "P A B" Output the number of different colors painted between segment A and segment B (including).
In our daily life, we have very few words to describe a color (red, green, blue, yellow…), so you may assume that the total number of different colors T is very small. To make it simple, we express the names of colors as color 1, color 2, ... color T. At the beginning, the board was painted in color 1. Now the rest of problem is left to your.

Input

First line of input contains L (1 <= L <= 100000), T (1 <= T <= 30) and O (1 <= O <= 100000). Here O denotes the number of operations. Following O lines, each contains "C A B C" or "P A B" (here A, B, C are integers, and A may be larger than B) as an operation defined previously.

Output

Ouput results of the output operation in order, each line contains a number.

Sample

線段樹+位運算+lazy思想。對于區(qū)間的顏色數(shù)用一個32位整數(shù)保存,該整數(shù)的二進制位每一位表示是否包含該顏色,對兩個整數(shù)的或運算可以求這兩個集合的并。

C - Stealing Harry Potter's Precious

Harry Potter has some precious. For example, his invisible robe, his wand and his owl. When Hogwarts school is in holiday, Harry Potter has to go back to uncle Vernon's home. But he can't bring his precious with him. As you know, uncle Vernon never allows such magic things in his house. So Harry has to deposit his precious in the Gringotts Wizarding Bank which is owned by some goblins. The bank can be considered as a N × M grid consisting of N × M rooms. Each room has a coordinate. The coordinates of the upper-left room is (1,1) , the down-right room is (N,M) and the room below the upper-left room is (2,1)..... A 3×4 bank grid is shown below:

Some rooms are indestructible and some rooms are vulnerable. Goblins always care more about their own safety than their customers' properties, so they live in the indestructible rooms and put customers' properties in vulnerable rooms. Harry Potter's precious are also put in some vulnerable rooms. Dudely wants to steal Harry's things this holiday. He gets the most advanced drilling machine from his father, uncle Vernon, and drills into the bank. But he can only pass though the vulnerable rooms. He can't access the indestructible rooms. He starts from a certain vulnerable room, and then moves in four directions: north, east, south and west. Dudely knows where Harry's precious are. He wants to collect all Harry's precious by as less steps as possible. Moving from one room to another adjacent room is called a 'step'. Dudely doesn't want to get out of the bank before he collects all Harry's things. Dudely is stupid.He pay you?$1,000,000 to figure out at least how many steps he must take to get all Harry's precious.

Input

There are several test cases.
In each test cases:
  The first line are two integers N and M, meaning that the bank is a N × M grid(0<N,M <= 100).
  Then a N×M matrix follows. Each element is a letter standing for a room. '#' means a indestructible room, '.' means a vulnerable room, and the only '@' means the vulnerable room from which Dudely starts to move.
The next line is an integer K ( 0 < K <= 4), indicating there are K Harry Potter's precious in the bank.
In next K lines, each line describes the position of a Harry Potter's precious by two integers X and Y, meaning that there is a precious in room (X,Y).
The input ends with N = 0 and M = 0

Output

For each test case, print the minimum number of steps Dudely must take. If Dudely can't get all Harry's things, print -1.

Sample

BFS+全排列。

D - Football

Consider a single-elimination football tournament involving 2%5En?teams, denoted 1%2C2%2C%5Ccdot%5Ccdot%5Ccdot%2C2%5En. In each round of the tournament, all teams still in the tournament are placed in a list in order of increasing index. Then, the first team in the list plays the second team, the third team plays the fourth team, etc. The winners of these matches advance to the next round, and the losers are eliminated. After?n?rounds, only one team remains undefeated; this team is declared the winner.

Given a matrix?P%20%3D%20%5Bp_%7Bij%7D%5D such that?p_%7Bij%7D?is the probability that team?i?will beat team?j?in a match determine which team is most likely to win the tournament.

Input

The input test file will contain multiple test cases. Each test case will begin with a single line containing?n~(1%20%5Cleq%20n%20%5Cleq%207) The next 2%5En?lines each contain 2%5En?values; here, the?jth value on the?ith line represents?p_%7Bij%7D. The matrix?P?will satisfy the constraints that?p_%7Bij%7D%20%3D%201%20-%20p_%7Bji%7D?for all?i%20%5Cneq%20j and?p_%7Bii%7D%20%3D%200.0 for all?i. The end-of-file is denoted by a single line containing the number ?1. Note that each of the matrix entries in this problem is given as a floating-point value. To avoid precision problems, make sure that you use either the?double?data type instead of?float.

Output

The output file should contain a single line for each test case indicating the number of the team most likely to win. To prevent floating-point precision issues, it is guaranteed that the difference in win probability for the top two teams will be at least 0.01.

Sample

概率DP+位運算。dp%5Bi%5D%5Bj%5D表示第i場比賽第j隊獲勝概率,狀態(tài)轉(zhuǎn)移方程為dp%5Bi%5D%5Bj%5D%20%2B%3Ddp%5Bi-1%5D%5Bj%5D*dp%5Bi-1%5D%5Bk%5D*p%5Bj%5D%5Bk%5D。注意兩隊相鄰時才能比賽:每輪淘汰一半的隊伍,所以可以右移一位操作;異或(XOR)1有個特性,可以讓偶數(shù)+1,奇數(shù)-1,利用這個特性可以判斷兩隊是否相鄰。

舉個例子,上圖中打?qū)︺^的隊伍在第一輪獲勝進入第二輪,用紅色虛線框出的就是第二輪比賽的隊伍。

E - Graph Game

目測博弈論,待補充(擺了)。

F - Hard Code

Some strange code is sent to Da Shan High School. It's said to be the prophet's note. The note is extremely hard to understand. However, Professor Meng is so smart that he successfully found the pattern of the code. That is, the length of the code is the product of two prime numbers. He tries to reallocate the code into a grid of size N*M, where M is the bigger prime. In specific, he writes down the letters of the code to the cells one by one, from left to right, and from top to button. In this way, he found the code eventually readable.
Professor Meng wants to know all the secrets of the note right now. But he doesn't take his computer with him. Can you help him?

Input

The first line of the input is L~(L%20%5Cleq%201000), which means the number of test cases.
For each test case, the first line contains two prime numbers, which indicates N%2C%20M~(0%20%3C%20N*M%20%5Cleq%201000) as describe above. The second line contains a string, i.e., the code, containing only lowercase letters. It’s guaranteed the length of the string equals to N * M.

Output

For each test case, output N lines, each line with M letters representing the readable code after the reallocation.

Sample

模擬題。字符串分割。

G - Hard Disk Drive

Yesterday your dear cousin Coach Pang gave you a new 100MB hard disk drive (HDD) as a gift because you will get married next year.
But you turned on your computer and the operating system (OS) told you the HDD is about 95MB. The 5MB of space is missing. It is known that the HDD manufacturers have a different capacity measurement. The manufacturers think 1 “kilo” is 1000 but the OS thinks that is 1024. There are several descriptions of the size of an HDD. They are byte, kilobyte, megabyte, gigabyte, terabyte, petabyte, exabyte, zetabyte and yottabyte. Each one equals a “kilo” of the previous one. For example 1 gigabyte is 1 “kilo” megabytes.
Now you know the size of a hard disk represented by manufacturers and you want to calculate the percentage of the “missing part”.

Input

The first line contains an integer T, which indicates the number of test cases.
For each test case, there is one line contains a string in format “number[unit]” where number is a positive integer within [1, 1000] and unit is the description of size which could be “B”, “KB”, “MB”, “GB”, “TB”, “PB”, “EB”, “ZB”, “YB” in short respectively.

Output

For each test case, output one line “Case #x: y”, where x is the case number (starting from 1) and y is the percentage of the “missing part”. The answer should be rounded to two digits after the decimal point.

Sample

模擬題。


Weekly Contest 2 - UM ICPC Training Group的評論 (共 條)

分享到微博請遵守國家法律
闽侯县| 孝义市| 黄浦区| 巴青县| 炉霍县| 郴州市| 繁峙县| 武城县| 富平县| 安平县| 高青县| 论坛| 蒙阴县| 华安县| 哈尔滨市| 胶州市| 时尚| 齐齐哈尔市| 多伦县| 哈巴河县| 衡山县| 元阳县| 离岛区| 读书| 通州区| 通辽市| 游戏| 合江县| 团风县| 马鞍山市| 涿鹿县| 阜城县| 旺苍县| 平果县| 乌鲁木齐县| 定边县| 和林格尔县| 黑水县| 沈丘县| 包头市| 渭源县|