# | Problem | Pass Rate (passed user / total user) |
---|---|---|
14303 | Natioanl ID Validation |
|
14304 | Prime Number |
|
14306 | The Mystical Bridge of Wasai |
|
Description
This is an advanced problem.
In Taiwan, national identification numbers are not randomly assigned. Valid national identification numbers must pass a verification process to make sure they are real ID numbers. Only those that pass this verification process are considered as valid national identification numbers.
A national ID number consists of an alphabet and 9 digits.
The unified ID number of the national identity card can be verified through the following formula:
- Transform the alphabet into two digits (a1, a2) e.g A-> 10
Alphabet | Number(a1, a2) |
---|---|
A | 10 |
B | 11 |
C | 12 |
D | 13 |
E | 14 |
F | 15 |
G | 16 |
H | 17 |
I | 34 |
J | 18 |
K | 19 |
L | 20 |
M | 21 |
N | 22 |
O | 35 |
P | 23 |
Q | 24 |
R | 25 |
S | 26 |
T | 27 |
U | 28 |
V | 29 |
W | 32 |
X | 30 |
Y | 31 |
Z | 33 |
- The 9 digits represent as n1-n9
- Convert the alphabets into numerical values and multiply them by 1, 9. Then, multiply the nine Arabic numerals (n1-n9) by 8, 7, 6, 5, 4, 3, 2, 1, 1 respectively, and sum them up.
- N = a1*1 + a2*9 + n1*8 + n2*7 + n3*6 + n4*5 + n5*4 + n6*3 + n7*2 + n8*1 + n9*1
- If N is the multiple of 10 it's a valid national ID number.
Input
You will get many national ID numbers, and not sure of the numbers of the ID numbers.
All the valid ID numbers' alphabet will be in the range:{A - G} and uppercase.
Output
Please validate the ID. After validating all ID numbers, rerun a string.
The string consists of all the alphabets of valid ID numbers and the sum of the numbers of valid IDs. The alphabets should be in the same order of input.
Take the example input as example:
Only the first 4 ID are valid.
A154712712 (O)
A166672796 (O)
E163326166 (O)
B117025840 (O)
456 (X)
x1234567895 (X)
C520149873 (X)
Only the first 4 IDs are correct.
The answer should be the first 4 IDs' alphabets (AAEB) combine with the sum of first 4 IDs' numbers (154712712+166672796+163326166+117025840 = 601737514)
=> AAEB601737514
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Create a program that finds all prime numbers (質數) and calculates their sum.
Note: 1 is not a prime number!
Input
A single line containing n space-separated integers.
-
1 <= n <= 100
-
Each integer in the line ranges from 1 to 1000.
Output
A single integer indicates the sum of all prime numbers found in the line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
In the mystical land of Wasai, there is a bridge that possesses extraordinary properties. This bridge allows only one person to cross at a time and has a unique height restriction: only those whose height does not exceed the average height of all individuals can pass.
Now, given the heights of a group of people, your task is to mark who can and cannot pass the bridge, using 1 and 0 to denote their eligibility.
Input
The input consists of multiple lines, each containing an integer representing the height of a person.
- Each height is between 1 to 200.
- There is at least 1 person.
Output
Output each person's eligibility corresponding to the order of input heights on a separate line:
- Output 1 if the person can pass.
- Output 0 if the person cannot pass.
Note: A person whose height equals the average height is also considered unable to pass.