# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12426 | Not Simple Unzip |
|
13291 | KONODIODA |
|
13669 | My tatto |
|
Description
After finishing the Simple ZIP program in the midterm practice, the next step is to write the unzip program to finish the whole zip/unzip project. It maybe an simple task for the safe/correct input, however your friend tell the bad news to you.In the reality, you can't always receive the safe/correct input, some input maybe the wrong format and make your program crash. Your program should handle the wrong input format.
The correct format of zip must be [integer][alpha][integer][alpha]....
[integer] is the integer > 0
[alpha] is the set of [a-z], [A-Z],['0','1',....'9']
[integer][alpha] is the basic zip pair unit
Take a correct format input for example : 3a3d4'1' should be unzip to aaaddd1111
Take a wrong format input for example : 5a5 should not be unzip and need to print out the error message "Can't unzip, the format is wrong!"
Note : If you are using visual studio, add #pragma warning(disable:4996) in the first line so that you can use scanf on your local machine.
Input
S_1
S_2
...
S_T
S_i :is the positive sequence ( 2 <= the size of the sequence <= 100)
T: is the number of testcase (2 <= T <= 10)
The input constraint:
1. The input symbol will only appear [a-z], [A-Z], [0-9],['0','1',....'9']
(it mean that the testcase will not include the sequence such like "%^@$@aabb'''11'z123'")
2. The integer number in the sequence is less than 100 and greater than -1
Testcase Hint:
Testcase 1 - 4 : safe input with the correct format
testcase 5 : safe input + wrong format input (wrong order of zip pair) ex: [alpha][inter], [integer][alpha][alpha][integer]...
Testcase 6 : safe input + wrong format input (mismatch pair) ex: [inter], [alpha], [inter][alpha][inter]...
testcase 7 : safe input + wrong format input (zero integer) ex: [0][alpha], [integer][alpha][0][alpha]...
Output
if the input sequence can be unzip then show the unzip result in the output, otherwise show the error messge "Can't unzip, the format is wrong!" in the output.(each line followed by a newline character)
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Dio, an evil vampire, does all kinds of evil and nobody can fight against him.
However, there's a brave man, JoJo, standing out and using all his ability to defeat him.
Everyone appreciate JoJo's great achievement and the world becomes safe and peace again.
Unfortunately, since Dio is a vampire, he revives himself again and tries to make more chaos......
We have known that there is a star-shaped birthmark on Dio's neck. To make sure that Dio is not able to enter our country, in the airport, we will use a special technique to scan a part of the visitors' skin and transfer the raw image to gray scale (0-255, 0 means black and 255 means white).
Given an image (square matrix) A[N,N], if point P(X,Y) is the center of a star, the following condition will be satisfied:
(1) A[X][j]=255, for all 0<=j<N (The values in the Xth row are all 255)
(2) A[i][Y]=255, for all 0<=i<N (The values in the Yth column are all 255)
(3)
A[X+i][Y+i]=255, for all -N<=i<N if 0<=(X+i)<N and 0<=(Y+i)<N
A[X+i][Y-i]=255, for all -N<=i<N if 0<=(X+i)<N and 0<=(Y-i)<N
(The values of two diagonals from the centers are all 255)
For example, a star looks like:
In this problem, given T square matrices wth size N, you are asked to find out how many stars in each matrix respectively.
Hint.
If you cannot pass all the testcases, you can try to use extra arrays to record some infomation when you read the input data.
By doing so, you can immediately determine whether a point is a star.
Input
There are three parts of the input:
(1) The number of testcases, T. 1<=T<=1000
(2) The size of the square matrices, N. 1<=N<=2048
(3) T N*N matrices separated by a newline character. 0<=The values in the matrices<=255.
Output
The number of stars in each matrix.
Note that you need to print "\n" in the end of each answer.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Peter wants to get a tatto.
However, he wants a fancy one instead of just a meaningless figure.
So, he dicides to choose a fancy number to be his new tatto.
The rule of determine a fancy number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x
is an integer that can divide x
evenly.
For example, 6 is a fancy number(1 + 2 + 3 = 6), 28 is also a fancy number(1 + 2 + 4 + 7 + 14 = 28), and 7 is not a fancy number.
Given a sequence of number, please help him find out whether it is fancy or not.
Hint: If you got a TLE in the last two testcases, please think about the number of iterations.
Input
A sequence of integers separated by a '\n'.
The input terminates until reading in EOF.
Each integer n is guranted that:
1 <= n <= 1e8
Output
For each number, if it is a fancy number, print "True".
If not, print "False".
You need to print a newline character at the end of each line. ('\n')