Submit | All submissions | Best solutions | Back to list |
PRIMES20 - PRIMES20 |
One day a mouse saw some cheese on the table but there was a cat in the house. So the mouse needed a plan to get the cat away from the table. His first idea was to make the cat chase him and then hide but then he thought of a safer idea, to go to the cat's toy basket and wind the cat's toy mouse up and make a squeak and let the toy mouse go.
So while the cat was chasing the toy mouse the real mouse climbed on the table. When he was about to climb back down the cat came back to the kitchen to drink. And saw the mouse and locked him in the cage now to open the cage mouse needs to solve one puzzle, which is given 2 numbers a and b write the smallest positive number c such that the sum of the numbers is prime.
INPUT
First line consists of an integer T and then T test cases follow.
Having the value of a and b
OUTPUT
For each test case you have to output the number c in a seperate line.
Constraints:
T <= 10^3
a and b will be between 1 and 10^6
SAMPLE EXAMPLE
Input:
1
1 1
Output:
1
Added by: | anuj |
Date: | 2012-02-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
2014-05-01 09:15:36 Francky
Moved to tutorial. |
|
2014-05-01 04:47:42 [Lakshman]
I don't understand the problem , Do we have to add c to both a ,b and check if they are prime or not? EDIT:: Got it. Should be in Tutorial. Last edit: 2014-05-01 05:00:24 |
|
2014-04-30 13:23:08 ivar.raknahs
AC:) in first attempt with py. |