MB1 - PP numbers
PP numbers are prime numbers and palindromes in decimal notation at once. Your task is to find n-th PP number in ascending order. Then calculate product of its non-zero digits - let's call it m - and find m-th prime number in ascending order.
Input
In the first line of input there is one positive integer Z (1 ≤ Z ≤ 1000) which states the number of test cases. Following Z lines contain test cases.
Each test case consists of one positive integer n (1 ≤ n ≤ 113) which states the number of PP number to find.
Output
For each test case print in separate line two numbers: n-th PP number and m-th prime number.
Example
Input: 3 1 5 2 Output: 2 3 11 2 3 5
hide comments
|
RIVU DAS:
2014-02-15 10:18:09
I hate precomputation!!! |
|
Arpit Uppal:
2014-02-02 10:53:02
no need of long long int.. int works fine.. and remember m= prod of non zero digits only |
|
Vipul Pandey:
2014-01-26 20:13:39
easy. AC in first attempt. |
|
Trilok Sharma:
2013-08-22 19:06:01
output for 113 is 98689 364523
|
|
abdou_93:
2013-05-03 22:12:32
time limit exceeded.... how?!!!!!!!!!!! |
|
Atul Kashyap:
2013-03-31 06:33:09
all those getting wa....read the q carefully.....m = pdt. 0 non-zero numbers only |
|
apsdehal:
2013-03-30 04:58:09
precomputation makes it a easy one!!! |
|
Francky:
2013-01-13 22:40:25
Warning : input seems badly formated. But, I don't know where is the problem.
|
|
Snehasish Roy ;):
2013-01-13 21:50:36
:D
|
|
Man Mohan Mishra:
2013-01-03 18:14:19
really nice problem !! :) |
Added by: | Maciej Boniecki |
Date: | 2010-04-02 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | 2nd Warsaw School of Computer Science Programming Championship |