Page 3 of 8
Posted: Sun Jul 18, 2004 12:54 pm
That's right. Repeatedly prime test would be a much more time consuming stuff. Avoid this would save a lot of time.
Posted: Sun Aug 15, 2004 3:42 pm
this is my code.
i think it is right.can someone tell me why i always gei WA
using namespace std;
Posted: Sun Sep 05, 2004 2:47 pm
please help me,i dont know why!!
removed after AC.
Re: 10533 WA
Posted: Wed Sep 15, 2004 9:59 pm
oulongbin wrote:please help me,i dont know why!!
Try this only in your output
I thinks it is the better form to make output
I got a lot of Wrong because this too!
Posted: Sat Sep 18, 2004 3:46 pm
thank you very much!
i got AC on your opinion,thanx!!
Posted: Sat Feb 05, 2005 4:52 pm
I am getting WA from the judge
. But all the samples I've tried home are correct. Please help if you can.
I will really appreciate some test cases.
Here is my code:
I've tried a lot and still WA. Please help !
Posted: Sun Feb 06, 2005 5:28 am
Nevermind. I got ACC at last
. I made a mistake in the output statement.
Here are some test cases :
HAVE A NICE DAY !
Posted: Thu Sep 22, 2005 3:24 pm
PLZ help me out. I am getting TLE.Advance thanks 2 the helpers.
#define max 1000009
Posted: Fri Sep 23, 2005 3:49 am
Fuad Hassan_IIUC(DC) wrote:
There maight be as many as 500000 test cases in the input and in any of them you may have t2=1000000. Just iterating through all numbers will not fit in the time limit. Try to find a more sophisticated solution.
Posted: Sat Nov 19, 2005 10:27 am
Thanks got AC.
Posted: Sat Nov 19, 2005 12:00 pm
you need to check the input number and the digit sum of the number both are prime..
Code: Select all
if (is_prime[i] && is_prime[sum])
dp[i] = dp[i-1] + 1;
dp[i] = dp[i-1];
Posted: Wed Feb 01, 2006 12:21 pm
i am not clear about a certain input which is
as your output is 4 while mine is 3 and when i traced it i found that it is three
from 3 to 20 inclusive (i.e. ignoring the limits) here are the prime numbers and digits
only which ae three only
i am consfused can you help me
Posted: Wed Feb 01, 2006 3:23 pm
primes between t1 and t2 (inclusive).
3 is also digit prime in 3 - 20
it will be 4 'cause - 3 , 5 , 7 , 11 ,
the term inclusive is applied to both t1 and t2 , not only t2
Get it ?
10533, TLE & TLE &.....
Posted: Wed Jun 28, 2006 5:21 pm
i m getting tle again and again for 10533.
what i did, the summary is here.
1. first i find all the prime numbers using sieve alg.
2.for each prime number i checked if it is digit prime.
3.i used a bool array digitPr to keep track the digit prime.
4. if the number n is digit prime then digitPr[n]=1 else 0
5. then i take the input t1 and t2
6. and count the 1s of the digitPr array within this range.
thats all. Any suggestion plz?
Plz help me to speedup my program..
Posted: Wed Jun 28, 2006 5:33 pm
Your all steps are great except step 6,
count is costly,
you have to do some dp
before starting taking input
better you manage another array,
such as NumberOfPrime[max],
and in NumberOfPrime store number of primes in between 0 and i
do it using your bool array
and then take input
and output must be NumberOfPrime[t2]-NumberOfPrime[t1-1],
its less costly