Submit | All submissions | Best solutions | Back to list |
PRIMESUM - Sum of two primes |
Given a number N (3<=N<=1000000) calculate all primes A and B with N=A+B and A<=B. The output for N is the sum of all its A or 0 if no A-B-pair was found.
Input
In the first line the number T (<=100) of tests, then T lines with one number N.
Output
The above explained sum of all its A for each N.
Example
Input: 4
3
4
10
26 Output: 0
2
8
23
Added by: | HWK |
Date: | 2011-03-02 |
Time limit: | 2.127s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: SCM qobi |
hide comments
2011-03-17 19:10:38 HWK
@hallvabo: My Python-solution: 175 Bytes and 11,64 secs. My Perl-solution: 140 Bytes and 19,34 secs. So you are the best. :-) |
|
2011-03-17 15:53:39 Piotr KÄ…kol
Maybe You will be glad HWK to submit His solutions? Yet, You're the best in Python and the competition isn't a big challenge for You in most of tasks (of course I may be wrong!). So that may be a way for making everybody satisfied. Of course, I'm not the author of the tasks so it's only HWK's and users' decision. It's only my suggestion. |
|
2011-03-17 15:06:37 Hallvard Norheim Bø
@HWK: what's the size of your best Python solution for this one? |
|
2011-03-13 15:01:59 HWK
I've increased the time-limit. @Daniel Hui: Thus it could be done in Perl. But your solution requires more than 60 secs. A much faster one would only need a few bytes more. Last edit: 2011-03-13 15:04:34 |