What's wrong with my code?!! I checked every sample output from this post & my code generate correct ans. but got WA in uva. plz help me.
#include<stdio.h>
#include<math.h>
int main()
{
long int n,n1,rs;
int i,j,r;
bool chk,chk2;
while(scanf("%ld",&n)!=EOF)
{
chk=true;
if(n==0 || n==1)
chk ...
Search found 5 matches
- Fri Oct 14, 2011 11:34 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10235 - Simply Emirp
- Replies: 150
- Views: 51200
- Mon Jun 13, 2011 3:01 pm
- Forum: Volume 112 (11200-11299)
- Topic: 11219 - How old are you?
- Replies: 117
- Views: 49522
Re: 11219 - How old are you?
why I got WA? I was check every input set (including from here). but still WA?!! :x :x :x Help me frndz
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i;
int dt1,mn1,yr1,dt2,mn2,yr2;
char a1,b1,a2,b2;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%c%d%c%d",&dt1,&a1,&mn1,&b1,&yr1 ...
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,i;
int dt1,mn1,yr1,dt2,mn2,yr2;
char a1,b1,a2,b2;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%c%d%c%d",&dt1,&a1,&mn1,&b1,&yr1 ...
- Sun May 15, 2011 10:29 am
- Forum: Volume 100 (10000-10099)
- Topic: 10018 - Reverse and Add
- Replies: 169
- Views: 43883
Re: 10018 - Reverse and Add
Why i got WA?
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,rs=0,r,i,fs,b,n,count;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
rs=0;
count=0;
while(a!=0)
{
b=a;
rs=0;
while(a!=0)
{
r=a%10;
rs=rs*10+r;
a=a/10;
}
fs=b+rs;
a=fs;
if( b == rs )
break ...
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,rs=0,r,i,fs,b,n,count;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&a);
rs=0;
count=0;
while(a!=0)
{
b=a;
rs=0;
while(a!=0)
{
r=a%10;
rs=rs*10+r;
a=a/10;
}
fs=b+rs;
a=fs;
if( b == rs )
break ...
- Thu May 12, 2011 9:20 pm
- Forum: Volume 4 (400-499)
- Topic: 483 - Word Scramble
- Replies: 122
- Views: 38867
Why compilation Error?!!!!
Why I got compilation error?!!!
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char a[1000];
while(scanf("%s",&a)==1)
{
if(a[0]=='\n' || a[1]=='\n')
printf("\n");
else
printf("%s ",strrev(a));
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char a[1000];
while(scanf("%s",&a)==1)
{
if(a[0]=='\n' || a[1]=='\n')
printf("\n");
else
printf("%s ",strrev(a));
}
return 0;
}
- Thu Apr 28, 2011 11:32 am
- Forum: Volume 4 (400-499)
- Topic: 494 - Kindergarten Counting Game
- Replies: 119
- Views: 37264
why WA in 494?!!
//why I got WA for this code?!!! plz help me.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int count=0;
char a[1000000];
char *p;
while(gets(a))
{
count=0;
p=strtok(a," !.");
while(p!=NULL)
{
p=strtok(NULL," !.");
count++;
}
printf("%d\n",count);
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int count=0;
char a[1000000];
char *p;
while(gets(a))
{
count=0;
p=strtok(a," !.");
while(p!=NULL)
{
p=strtok(NULL," !.");
count++;
}
printf("%d\n",count);
}
return 0;
}