The ACM/ICPC Asia Harbin Online First Round Contest 2010 Warmup-2

1001

table

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 1692   Accepted: 270  

Description

There is a table, on which some plates were put in a circle. Some apples were put in the plates. Let's play a game. For each plate, separate the apples into two parts. For example if a plate containing M apples, put M/2 apples into the lefthand plate and the rest to the righthand plate. Note that if M is a odd number, then M/2 equals (M-1)/2. Plates are numbered from 1 to N in counter-clockwise. The lefthand plate is the plate whose number is smaller. The lefthand plate of plate numbered 1 is the plate numbered N. Given the number of apples in each plate(1,2,...N), output the the number of apples in each plate when game is over.

Input

The input contains multiple test case. The first line of each case contains a integer N, the number of plates on the table, followd by N integers representing the number of apples in the plates(1,2,...N).

Output

For each test case print the number of apples in each plate(from numbered 1 to N) when game is over.

Sample Input


5
1 2 3 4 5
10
1 2 3 4 5 6 7 8 9 10

Sample Output


4 2 3 4 2
6 2 3 4 5 6 7 8 9 5

 

 

 

print

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 544   Accepted: 364  

Description

Give you a number, print characters like this:

1
*
2
...
.*.
...
3
*****
*...*
*.*.*
*...*
*****

Input

The input contains multiple test cases. Each case consist of a integer n.

Output

For each test case, print the character table like the examples.

Sample Input


1
2
3
4
5

Sample Output


*
...
.*.
...
*****
*...*
*.*.*
*...*
*****
.......
.*****.
.*...*.
.*.*.*.
.*...*.
.*****.
.......
*********
*.......*
*.*****.*
*.*...*.*
*.*.*.*.*
*.*...*.*
*.*****.*
*.......*
*********

 

 

1003

count

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 1191   Accepted: 342  

Description

Given a number of strings, can you find how many times a string appear in the input?

Input

The input contains multiple test cases. Each case begins with a integer N(the number of strings you will get, N<=100000), followed by N lines, each consists of a string.

Output

For each test case, print "Case K:" where K is the Kth case. K begins with 1. Then print the times(T) a string appears and the number(M) of strings that appear T times. Don't print T or M where M<=0. The output is ordered by T. The length of each strings won't longer than 20.

Sample Input


5
BBA
BBA
BEA
DEC
CCF

Sample Output


Case 1:
1 3
2 1

 

 

1004

 

Sum Of SubRectangular Parallelepiped

TimeLimit: 2 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 503   Accepted: 144  

Description

There is a rectangular parallelepiped with a integer in each cell.Can you caculate the maximum sum of sub rectangular parallelepipeds?

Input

Input contains multiple test cases. The first line is the test number T, followed by cases. Each case begin with three integer L,M,N presenting the rectangular parallelepiped you will get. Then L matrixes each with M rows and N column follow.

Output

For each case print a line with the maximum sum of sub rectangular parallelepipeds.If all the integers are negtive,print 0.

Sample Input


1
2 2 2
7 -4
3 7

-9 -6
4 7

Sample Output


21

  

1006

 

ACM again- Ancient China Mathematics again

TimeLimit: 1 Second   MemoryLimit: 32 Megabyte

Totalsubmit: 263   Accepted: 20  

Description

ACM again- Ancient China Mathematics again
ACM again- Ancient China Mathematics again


Dr.K has published a essay on ACM(Ancient China Mathematics), he asked me to thank you for your help what really helped a lot. But another problem raised that the ACM is not as simple as we descripted last time.

In order to help you understand it, we should first go over the ancient people's counting system again:

1、They use only 7 digits to represent numbers, and numbers are as follow:

| -> 1

|| -> 2

||| -> 3

|||| -> 4

||||| -> 5

|||||| -> 6

||||||| -> 7

It is a pity that they have not developed "0" before these people disapeared.

2、If a number is greater than 7, they use digit place just as we do today. Between each two digit places, there is a ",".

eg:

|||||,|| -> 42 (5x8+2)

|||,||,|||| -> 212 (3*64+2*8+4)

In Dr.K's further study, he noticed that, there comes another two symbols - "[" and "]". They are often used together and there is always an expression between them. To see it more clearly, we define it as a grammer expression:

expression = [exp1]

exp1 = [exp1] | [exp1]exp1 | exp1[exp1] | Digit

Digit = "|" | "||" | "|||" | "||||" | "|||||" | "||||||" | "|||||||"

For example:

[||,||||]

[[||][||,|]]

[||[|||][|||||,|]]

are all acceptable expressions.


But what does these expressions mean? That really confused Dr.K a long time, fortunately, he conquered it. He found that:

1、"[]" is used in pairs and all the time with an expersion between them.

2、An expersion is always a number (certainly in their "|||..." form) or another expression.

3、An "exp1[exp2]" or "[exp1]exp2" expersion means exp1 + exp2.

4、An "[exp1][exp2]" expersion means exp1 x exp2.

For example:

[||[||]] = 2+2 = 4

[|] = 1

[[||][|,|]] = 2x9 = 18

[||[[||]|][||]|,||] = 2+(2+1)x2+10 = 18

As same as mordern mathematics, multiplication is piror to addition, and expersion in a "[]" should be count piror to the outer expersion.

For another time, he turns to you for help, it is sure that you will not let him down.

Input

The first line of standard input contains an integer N, the number of test cases. N lines followed.

In each line a squence is given, it is guaranteed that the length of the squence will not exceed 1024 characters and the outcome number will not be greater than 1000000.

Output

For each case you are to output a line giving the number in today's decimal counting system.

Sample Input


3

[||[||]]

[|]

[[||][|,|]]

Sample Output


4

1

18

 

 

 

今天的名次是33,嘿,按照成绩说还是不错的。不过让我感觉到有很多高手没有参加,否则会是这个名词吗???

桂晨先把1003用map水过去,接着我没过多久,冯新宇把三维的最大字段和A掉,我是最悲剧的,那个print题花了我1个小时,一直再找bug,还好最后找到了。那个1001数据有问题,挂了1400来人,桂做完了一直没提交,等到哈工大说数据有误抱歉时,桂才提交。

今天的比赛我们全是1Y,而且是4道题中排名第二的,所以才是33名。

悲剧的还是我,最后那个表达式计算根本没做过,我写了近俩小时……悲剧啊!!!

还有1005没读懂题……………………  以后怎么办???

 

一句话 会的太少!!!

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值