本站作为LDUOnlineJudge的测试版本进行演示,官方网站请访问http://icpc.ldu.edu.cn
[Hidden ☆ before use]

1197. G. Sorry About That, Chief!


Description

When Dr. Orooji was your age, one of the popular TV shows was “Get Smart!” The main
character in this show (Maxwell Smart, a secret agent) had a few phrases; we used one such
phrase for the title of this problem and we’ll use couple more in the output!
The Problem:
A “prime” number is an integer greater than 1 with only two divisors: 1 and itself; examples
include 5, 11 and 23. Given a positive integer, you are to print a message indicating whether the
number is a prime or how close it is to a prime.

Input

The first input line contains a positive integer, n (n ≤ 100), indicating the number of values to
check. The values are on the following n input lines, one per line. Each value will be an integer
between 2 and 10,000 (inclusive).

Output

At the beginning of each test case, output “Input value: v” where v is the input value.
Then, on the next output line, print one of the following two messages:
- If the number is a prime, print “Would you believe it; it is a prime!”
- If the number is not a prime, print “Missed it by that much (d)!” where d
shows how close the number is to a prime number (note that the closest prime number
may be smaller or larger than the given number).
Leave a blank line after the output for each test case. Follow the format illustrated in Sample
Output.

Samples

Input Copy
4
23
25
22
10000
Output
Input value: 23
Would you believe it; it is a prime!

Input value: 25
Missed it by that much (2)!

Input value: 22
Missed it by that much (1)!

Input value: 10000
Missed it by that much (7)!

Source

UCF2011
Problem Information

Time Limit: 1000MS (C/C++,Others×2)
Memory Limit: 128MB (C/C++,Others×2)
Special Judge: No
AC/Submit: 1 / 1
Tags:
Contests involved

1023. UCF 2011
My history solutions

You didn't submit any solution!
Submit your solution

Login Register