No.446 Rain and Snow of yukicoder (1)
Problem Statement
Ame-kun is going to help his older sister Yuki, who runs "yukicoder".
The job assigned to Ame-kun this time is to create an easy problem to be used as the first problem of a contest.
So Ame-kun decided to create the following A + B problem.
Problem Statement
Given an integer $A$ on the first line and an integer $B$ on the second line, print $A + B$.
Input
$A$ $B$All inputs are integers and satisfy the following constraints.
- $0 \leq A, B \leq 12345$
Output
Print the result of $A + B$ on one line.
Print a newline at the end.
Ame-kun had smoothly made everything up to the test cases, but it turned out that the program generating the test cases was buggy.
So Ame-kun decided to write a program that checks whether a test case satisfies the format and constraints of the problem above.
Note that a case with leading zeros (unnecessary zeros continuing from the beginning of the string) is also considered not to satisfy the format.
Input
$A$ $B$
A string $A$ is given on the first line, and a string $B$ on the second line.
Each string consists only of half-width alphanumeric characters (0-9, A-Z, a-z) and contains no spaces or symbols such as + or -.
The length of each string is guaranteed to be at least 1 and at most 5.
Output
Print "OK" if the input satisfies the format and constraints of the A + B problem above, and "NG" if it does not.
Print a newline at the end.
Sample
Sample 1
Input
123 4eF
Output
NG
"123" is fine, but "4eF" is not a number, so this is invalid.
Sample 2
Input
21000 00012
Output
NG
"21000" is greater than 12345, so it does not satisfy the constraints.
"00012" contains unnecessary zeros at the beginning, so it does not satisfy the format.
Sample 3
Input
FFFF 0x10
Output
NG
Both are invalid.
Sample 4
Input
0 12345
Output
OK
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
りあん
37zigen