Submit  All submissions  Best solutions  Back to list 
MB1CH  PP numbers 
PP numbers are prime numbers and palindromes in decimal notation at once. Your task is to find nth PP number in ascending order. Then calculate product of its nonzero digits  let's call it m  and find mth 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: nth PP number and mth prime number.
Score
Score equals to size (in bytes) of source code of your program. The fewer points you score, the better.
Example
Input:
3 1 5 2
Output:
2 3 11 2 3 5
Added by:  Maciej Boniecki 
Date:  20100918 
Time limit:  3.150s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: SCM qobi 
Resource:  2nd Warsaw School of Computer Science Programming Championship 
hide comments


20131207 14:18:33 Piotr KÄ…kol
Done. 

20131206 03:19:58 Hallvard Norheim Bø
@Piotr: Python 2.7 submissions here need rejudge, some AC solutions are not valid in 2.7. 

20120530 12:35:43 Hallvard Norheim Bø
It looks like Python 2.5 has silently been upgraded to 2.7 on spoj.pl. If you rejudge, all Python solutions which pass a float when an int is expected (range(), os.read() etc) will fail. So will all solution close to the time limit, since 2.7 is significantly slower than 2.5. The best solution would be to restore Python 2.5. If this is not possible, a rejudge of all Python solutions to all challenges are needed :/ This will give NZEC or TLE for a lot of current AC Python solutions. Last edit: 20120530 12:38:23 

20120530 09:14:37 Piotr KÄ…kol
So should I rejudge all Python submission? Are some codes out of date? 

20120530 01:27:31 Hallvard Norheim Bø
My old Python 2.5 solution suddenly got NZEC, while the 3.1.2 version works just fine. Is Python 2.5 currently broken? Update: avoiding float argument to range() and changing "0or 1" to "0 or 1" made it pass. Looks like Python 2.5 really is Python 2.7 :( Last edit: 20120530 12:42:19 

20101018 18:17:18 Maciej Boniecki
I have increased time limit to 20s per test. Rejudge in progress... 

20101011 19:59:22 Piotr KÄ…kol
10sec for each test. So even if there are only 2 tests it's possible. It also can't be checked how much time a submission needed because executing is stopped when time exceed time limit. It can be only check by author of the task changing time limit into for example 100s, then rejudging, and if there's no TLE You would see the real time. If You want You may contact the author if in Your opinion it's necessary. Last edit: 20101011 20:05:54 

20101011 15:00:43 HWK
Is the time limit really 10 secs? If so: Why the 1st rank needed 19,71 secs? How long needed my submission 4149963? 

20100923 04:19:00 :(){ :: & };:
So now when I wrote something efficient it passes both of your task. 