I have increased the array size and the intput without the ending dot
is also correct.
pls. tell me the bug of this.
Search found 15 matches
- Sun Jun 30, 2002 11:04 pm
- Forum: Volume 4 (400-499)
- Topic: 492 - Pig-Latin
- Replies: 213
- Views: 49374
- Sun Jun 30, 2002 10:58 pm
- Forum: Volume 4 (400-499)
- Topic: 488 - Triangle Wave
- Replies: 270
- Views: 64316
- Sun Jun 30, 2002 10:52 pm
- Forum: Volume 4 (400-499)
- Topic: 488 - Triangle Wave
- Replies: 270
- Views: 64316
- Sun Jun 30, 2002 10:38 pm
- Forum: Volume 4 (400-499)
- Topic: 488 - Triangle Wave
- Replies: 270
- Views: 64316
- Sun Jun 30, 2002 10:36 pm
- Forum: Volume 4 (400-499)
- Topic: 495 - Fibonacci Freeze
- Replies: 222
- Views: 59866
- Sat Jun 29, 2002 5:33 am
- Forum: Volume 5 (500-599)
- Topic: 573 - The Snail
- Replies: 45
- Views: 27874
- Sat Jun 29, 2002 5:27 am
- Forum: Volume 4 (400-499)
- Topic: 492 - Pig-Latin
- Replies: 213
- Views: 49374
492 - Pig-Latin
Please tell me why it is W.A.
#include<stdio.h>
#include<ctype.h>
#include<iostream.h>
int main()
{
int vo[10]={65,97,69,101,73,105,79,111,85,117};
int ch;
char pig[10000];
int flag=0,flag1=1,flag2=0;
int con;
long l=0;
while((ch=getchar())!=EOF)
{
if(isalpha(ch)!=0)
{
flag2=0;
if ...
#include<stdio.h>
#include<ctype.h>
#include<iostream.h>
int main()
{
int vo[10]={65,97,69,101,73,105,79,111,85,117};
int ch;
char pig[10000];
int flag=0,flag1=1,flag2=0;
int con;
long l=0;
while((ch=getchar())!=EOF)
{
if(isalpha(ch)!=0)
{
flag2=0;
if ...
- Sat Jun 29, 2002 5:25 am
- Forum: Volume 4 (400-499)
- Topic: 455 - Periodic Strings
- Replies: 73
- Views: 28847
455 - Periodic Strings
Pleaes tell me the fault of this code.
Why it is W.A??
#include<iostream.h>
#include<string.h>
int main()
{
char t[100];
int r;
while(cin>>t)
{
int s=strlen(t);
char p[100];
char ch[2]={0};
ch[0]=t[0];
strcpy(p,ch);
int i;
for(i=1,r=1;i<s;i++,r++)
{
int l,k=1,count,max,index=0,b=0 ...
Why it is W.A??
#include<iostream.h>
#include<string.h>
int main()
{
char t[100];
int r;
while(cin>>t)
{
int s=strlen(t);
char p[100];
char ch[2]={0};
ch[0]=t[0];
strcpy(p,ch);
int i;
for(i=1,r=1;i<s;i++,r++)
{
int l,k=1,count,max,index=0,b=0 ...
- Sat Jun 29, 2002 5:22 am
- Forum: Volume 4 (400-499)
- Topic: 488 - Triangle Wave
- Replies: 270
- Views: 64316
Please help with 488
Can some one tell me why it is W.A??
#include<iostream.h>
int main()
{
unsigned long a,f;
while(cin>>a>>f)
{
if(a<=9)
{
for(unsigned long i=1;i<=f;i++)
{
unsigned long j;
for(j=1;j<=a;j++)
{
for(unsigned long k=1;k<=j;k++)
cout<<j;
cout<<"\n";
}
for(unsigned long l=j-2;l>=1;l ...
#include<iostream.h>
int main()
{
unsigned long a,f;
while(cin>>a>>f)
{
if(a<=9)
{
for(unsigned long i=1;i<=f;i++)
{
unsigned long j;
for(j=1;j<=a;j++)
{
for(unsigned long k=1;k<=j;k++)
cout<<j;
cout<<"\n";
}
for(unsigned long l=j-2;l>=1;l ...
- Fri Jun 28, 2002 7:30 pm
- Forum: Volume 4 (400-499)
- Topic: 495 - Fibonacci Freeze
- Replies: 222
- Views: 59866
- Fri Jun 28, 2002 10:56 am
- Forum: Volume 4 (400-499)
- Topic: 495 - Fibonacci Freeze
- Replies: 222
- Views: 59866
- Fri Jun 28, 2002 10:44 am
- Forum: Volume 4 (400-499)
- Topic: 495 - Fibonacci Freeze
- Replies: 222
- Views: 59866
Please help with 495
Can anyone tell me why this code of mine is W.A?
#include<iostream.h>
#include<string.h>
int main()
{
char *fibo[5001]={0};
fibo[0]="0";
fibo[1]="1";
int l1=strlen(fibo[0]);
int l2=strlen(fibo[1]);
int l;
for(long i=2;i<=5000;i++)
{
char str[10000];
if(l1>=l2)l=l1;
else l=l2;
int ca=0 ...
#include<iostream.h>
#include<string.h>
int main()
{
char *fibo[5001]={0};
fibo[0]="0";
fibo[1]="1";
int l1=strlen(fibo[0]);
int l2=strlen(fibo[1]);
int l;
for(long i=2;i<=5000;i++)
{
char str[10000];
if(l1>=l2)l=l1;
else l=l2;
int ca=0 ...
- Fri Jun 28, 2002 10:19 am
- Forum: Volume 5 (500-599)
- Topic: 573 - The Snail
- Replies: 45
- Views: 27874
- Thu Jun 27, 2002 11:43 pm
- Forum: Volume 5 (500-599)
- Topic: 543 - Goldbach's Conjecture
- Replies: 109
- Views: 41025
543 - Goldbach's Conjecture
#include<iostream.h>
#include<math.h>
int main()
{
int prime[1000000]={0};
prime[2]=1;
prime[3]=1;
for(long k=5;k<1000000;k+=2)
{
int a=0;
for(long l=3;l<k;l+=2)
{
if(prime[l]==1)
{
if(k%l==0)
{
a=1;
break;
}
if(prime[l]>(long)(sqrt(k)+0.5))break;
}
}
if(a==0)prime[k]=1 ...
#include<math.h>
int main()
{
int prime[1000000]={0};
prime[2]=1;
prime[3]=1;
for(long k=5;k<1000000;k+=2)
{
int a=0;
for(long l=3;l<k;l+=2)
{
if(prime[l]==1)
{
if(k%l==0)
{
a=1;
break;
}
if(prime[l]>(long)(sqrt(k)+0.5))break;
}
}
if(a==0)prime[k]=1 ...
- Thu Jun 27, 2002 11:39 pm
- Forum: Volume 5 (500-599)
- Topic: 573 - The Snail
- Replies: 45
- Views: 27874
573 - The Snail
#include<iostream.h>
int main()
{
double h,u,d,f;
while(cin>>h>>u>>d>>f&&h>0)
{
double ih=0;
double hc=ih+u;
double hs=hc-d;
double fa=(u*f)/100.00;
long day=1;
int a=0,b=0;
do
{
ih=hs;
u-=fa;
if(u>=0)
{
hc=ih+u;
}
else hc=ih;
hs=hc-d;
day++;
if(hs<0||hc>=h)b=1;
if(hs<0)a=1 ...
int main()
{
double h,u,d,f;
while(cin>>h>>u>>d>>f&&h>0)
{
double ih=0;
double hc=ih+u;
double hs=hc-d;
double fa=(u*f)/100.00;
long day=1;
int a=0,b=0;
do
{
ih=hs;
u-=fa;
if(u>=0)
{
hc=ih+u;
}
else hc=ih;
hs=hc-d;
day++;
if(hs<0||hc>=h)b=1;
if(hs<0)a=1 ...