TopCoder

icube
baluteshih 好強 <(_ _)>

User's AC Ratio

91.7% (11/12)

Submission's AC Ratio

46.9% (15/32)

Tags

Description

承上題,你能用更快的速度算出答案嗎?

Input Format

輸入的第一行是一個正整數T ( 1≦T≦1,000,000 ),代表接下來有T筆測資,
接下來的T行,每行會有一個正整數 n ( 2≦n≦2,147,483,646),代表照片的寬度。
你可以假設n一定會是偶數。

子任務(測資) 額外限制 分數
1 (0~4) T=1 20
2 (5~7) T≦100,000, n≦1,000,000 20
3 (0~9) 無限制 60

Output Format

對於每筆測資輸出一行,代表寬度n的照片中,山稜線的數量除以11的餘數。

Sample Input 1

3
2
16
52

Sample Output 1

1
0
7

Hints

Problem Source

Problem set / Description by Paupière

Subtasks

No. Testdata Range Score
1 0~4 20
2 5~7 20
3 0~9 60

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 262144 1 3
1 1000 65536 262144 1 3
2 1000 65536 262144 1 3
3 1000 65536 262144 1 3
4 1000 65536 262144 1 3
5 1000 65536 262144 2 3
6 1000 65536 262144 2 3
7 1000 65536 262144 2 3
8 4000 65536 262144 3
9 4000 65536 262144 3