Page 2 of 3
Posted: Wed Jul 04, 2007 3:09 pm
by fuad420

How comes 1 a prime number?????????!!!!!!!! that is really funny and joking.
why wa
Posted: Mon Jul 09, 2007 9:48 pm
by bishop
it show prime num 1
but still Wrong answer
plz help for
thanks
but in upper post
1,3,5...... odd number denoted by prime number
so i thought 2 is not prime
Posted: Mon Jul 09, 2007 11:48 pm
by Rocky
u need to check ur code again.it need too many modification....
u do p[2]=false but 2 is prime....
again u loop from 3 up to 35....but what happen for 4,8,....it is not prime too.
and ur sum is also incorrect for UPPERCASE.check it.
GOOD LUCK
Rocky
10924 WA
Posted: Wed Aug 01, 2007 7:10 am
by starrynight
excuse me ,can anyone tell me why I got a WA?
because I can't find where I do wrong .
thanks in advance
and sorry for my poor English..
Code: Select all
#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
char word[21];
double sum=0;
int i,y,factor;
while(gets(word) != NULL)
{
factor=0;
for(i=0;i<20;i++)
{
if(word[i]>='a' && word[i]<='z')
sum = sum +(word[i]-96);
else if(word[i]>='A' && word[i]<='Z')
sum = sum +(word[i]-38);
}
for (y = 2; y <= sqrt(sum); y++)
{
if ( fmod(sum,y)==0 )
factor++;
}
if (factor == 0)
printf("It is a prime word.\n");
else
printf("It is not a prime word.\n");
}
return 0;
}
Posted: Wed Aug 01, 2007 7:51 am
by helloneo
Try this case..
My output is..
Code: Select all
It is a prime word.
It is a prime word.
It is a prime word.
It is not a prime word.
It is a prime word.
It is not a prime word.
It is not a prime word.
It is a prime word.
It is not a prime word.
It is a prime word.
Posted: Wed Dec 05, 2007 7:17 am
by laicc86
can anyone help me? i don't know why i got WA for this.
Posted: Wed Dec 05, 2007 8:23 am
by helloneo
gets returns NULL instead of EOF at the end of input..
PS. remove your code after AC..
Posted: Wed Dec 05, 2007 12:30 pm
by laicc86
helloneo wrote:gets returns NULL instead of EOF at the end of input..
PS. remove your code after AC..
thx for helping~ but i still get WA after i changed the EOF to NULL

Posted: Wed Dec 19, 2007 5:33 pm
by turcse143
It is very simple problem.
Use the ASCII value & subtract to generate the number check number is prime or not.
For reducing the time u will generate all the prime of the given range before.
WA I don't know why!
Posted: Mon Dec 24, 2007 9:44 pm
by ligregni
hi!, this is my code
I tried all the single letters, the example cases, the test cases here, and I still getting WA with almost no time (sometimes 0.010 or other times 0.000), I also tried not to print the '\n' at the end
changed by
and it is the same.
Please HELP!!!
I have SOME ADVICES!
an EMPY string should NOT to print ANYTHING
1 is prime
print a \n after ALL cases
[/quote]
Re: 10924 - Prime Words
Posted: Wed Oct 29, 2008 12:50 am
by aliahmed
AC.
Re: 10924 - Prime Words
Posted: Sun Dec 28, 2008 12:34 am
by sazzadcsedu
whats wrong with this code!!!!!!!!!
i got WA.
try my best.but cant find the problem.
plz plz someone help.
here is my code
Re: 10924 - Prime Words
Posted: Sun Dec 28, 2008 3:32 am
by mf
sazzadcsedu wrote:whats wrong with this code!!!!!!!!!
i got WA.
Oh really? I think you should have got compile error with the code you've posted.
After you fix it, you might want to check again this part of your code:
Code: Select all
memset(prime,0,sizeof(prime));
for(i=2;i<=20;i++)
{
for(j=2;j<=60;j++)
{
prime[i*j]=1;
}
}
E.g. 1018=2*519 is composite, but your code would claim it's not.
Horrible indenting, btw. If it's not caused by a forum bug (tab=3 spaces), I think you really need to learn some good indenting style.
Re: 10924 - Prime Words
Posted: Sun Dec 28, 2008 8:48 pm
by sazzadcsedu
Infact i made a stupid mistake.
but now got AC.
thanx a lot mf.
need ur help later(comming!!!).
10924 - Prime Words
Posted: Thu Jan 21, 2010 8:28 am
by mintae71
Please help me.....
Here is my code.
please help me....
Please check my code or give me a sample of test data...