Search found 14 matches
- Sat Nov 17, 2012 11:35 am
- Forum: Volume 1 (100-199)
- Topic: 101 - The Blocks Problem
- Replies: 635
- Views: 109826
Re: 101 , Code in C++, Runtime error
Any help??
- Wed Sep 19, 2012 2:06 pm
- Forum: Volume 1 (100-199)
- Topic: 101 - The Blocks Problem
- Replies: 635
- Views: 109826
Re: 101 , Code in C++, Runtime error
Please Help, I am getting Time Limit each time i submit. I guess my program fell into infinite loop somewhere. Can anybody provide me some critical input.
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
using namespace std;
#define TRUE 1
#define FALSE 0 ...
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
using namespace std;
#define TRUE 1
#define FALSE 0 ...
- Sun Jun 17, 2012 12:59 am
- Forum: Volume 1 (100-199)
- Topic: 108 - Maximum Sum
- Replies: 233
- Views: 52027
108-Maximum Sum WA
Hi,
This is my code. I tried the test cases from the algorithmist site which seems to give me correct answer.But i am getting WA after submission:
#include<iostream>
using namespace std;
void Get_Max_Sum(int **array_2d,int row_sum[],int row2_sum[],int col_sum[],int col2_sum[],int size);
int main ...
This is my code. I tried the test cases from the algorithmist site which seems to give me correct answer.But i am getting WA after submission:
#include<iostream>
using namespace std;
void Get_Max_Sum(int **array_2d,int row_sum[],int row2_sum[],int col_sum[],int col2_sum[],int size);
int main ...
- Fri Apr 29, 2011 4:51 pm
- Forum: Volume 106 (10600-10699)
- Topic: 10656 - Maximum Sum (II)
- Replies: 52
- Views: 23742
Re: 10656 - Maximum Sum (II)
I am getting PE,please help:
#include<stdio.h>
#define SIZE 1010
int main(void)
{
int i,j,n,flag=0;
unsigned int num[SIZE];
while(1)
{
flag=0;
scanf("%d",&n);
if(n==0)
break;
for(i=0;i<n;i++)
scanf("%u",&num[i]);
if(num[0]==0)
flag=1;
i=0;
if(flag==1)
while((num[i]==0) && (i<n ...
#include<stdio.h>
#define SIZE 1010
int main(void)
{
int i,j,n,flag=0;
unsigned int num[SIZE];
while(1)
{
flag=0;
scanf("%d",&n);
if(n==0)
break;
for(i=0;i<n;i++)
scanf("%u",&num[i]);
if(num[0]==0)
flag=1;
i=0;
if(flag==1)
while((num[i]==0) && (i<n ...
- Wed Mar 16, 2011 10:14 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10324 - Zeros and Ones
- Replies: 179
- Views: 67318
Re: 10324 - Zeros and Ones
Why WA:
#include<stdio.h>
#include<string.h>
#define SIZE 1000002
#define MAX(i,j) (i>j)?i:j
#define MIN(i,j) (i<j)?i:j
int Find_Result(char [],long,long);
int main(void)
{
char str[SIZE];
long i,j;
int k,n,l;
l=0;
while(gets(str)){
if(strlen(str)==0)
break;
scanf("%d",&n);
l++;
for(k ...
#include<stdio.h>
#include<string.h>
#define SIZE 1000002
#define MAX(i,j) (i>j)?i:j
#define MIN(i,j) (i<j)?i:j
int Find_Result(char [],long,long);
int main(void)
{
char str[SIZE];
long i,j;
int k,n,l;
l=0;
while(gets(str)){
if(strlen(str)==0)
break;
scanf("%d",&n);
l++;
for(k ...
- Wed Sep 29, 2010 10:27 pm
- Forum: Volume 7 (700-799)
- Topic: 713 - Adding Reversed Numbers
- Replies: 142
- Views: 61005
Re: 713 - Adding Reversed Numbers
Hi,
can anyone tell me why am i getting WA:
#include<stdio.h>
#include<string.h>
int main()
{
char num1[201],num2[201],tmp[201],sum[202],out1[202];
int n1,n2,carry,len1,len2,i,j,k,s,input,m,n,t,out;
carry=len1=len2=i=k=j=0;
while((scanf("%d",&input))==1)
{
for(m=0;m<input;m++)
{
scanf("%s %s ...
can anyone tell me why am i getting WA:
#include<stdio.h>
#include<string.h>
int main()
{
char num1[201],num2[201],tmp[201],sum[202],out1[202];
int n1,n2,carry,len1,len2,i,j,k,s,input,m,n,t,out;
carry=len1=len2=i=k=j=0;
while((scanf("%d",&input))==1)
{
for(m=0;m<input;m++)
{
scanf("%s %s ...
- Sat Aug 28, 2010 4:05 pm
- Forum: Volume 4 (400-499)
- Topic: 441 - Lotto
- Replies: 13
- Views: 9653
Re: 441 - Lotto PE
I have modified the code as what u have said,still no luck:
#include<stdio.h>
int main()
{
int i,j,size,a[49],b[6],l,k,m,n,c=0;
while(1)
{
if(c==1)
printf("\n");
scanf("%d",&size);
if(size==0)
break;
for(i=0;i<size;i++)
{
scanf("%d",&a[i]);
if(i<6)
b[i]=a[i];
}
c=1;
j=4;
l=5;
n=l ...
#include<stdio.h>
int main()
{
int i,j,size,a[49],b[6],l,k,m,n,c=0;
while(1)
{
if(c==1)
printf("\n");
scanf("%d",&size);
if(size==0)
break;
for(i=0;i<size;i++)
{
scanf("%d",&a[i]);
if(i<6)
b[i]=a[i];
}
c=1;
j=4;
l=5;
n=l ...
- Fri Aug 27, 2010 8:19 pm
- Forum: Volume 4 (400-499)
- Topic: 441 - Lotto
- Replies: 13
- Views: 9653
Re: 441 - Lotto PE
Hi,
Sorry for reviving an old thread,but I am not sure why am i getting WA:
#include<stdio.h>
int main()
{
int i,j,size,a[49],b[6],l,k,m,n;
while(1)
{
scanf("%d",&size);
if(size==0)
break;
for(i=0;i<size;i++)
{
scanf("%d",&a[i]);
if(i<6)
b[i]=a[i];
}
j=4;
l=5;
n=l+1;
m=size ...
Sorry for reviving an old thread,but I am not sure why am i getting WA:
#include<stdio.h>
int main()
{
int i,j,size,a[49],b[6],l,k,m,n;
while(1)
{
scanf("%d",&size);
if(size==0)
break;
for(i=0;i<size;i++)
{
scanf("%d",&a[i]);
if(i<6)
b[i]=a[i];
}
j=4;
l=5;
n=l+1;
m=size ...
- Sun Jun 06, 2010 3:28 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10070 - Leap Year or Not Leap Year and ...
- Replies: 233
- Views: 84177
Re: 10070 - Leap Year or Not Leap Year and …
Why am i getting wrong answer, i checked all output,they seems right to me:
#include<stdio.h>
#include<string.h>
int div_by_100(char *year)
{
long int i;
i=strlen(year);
if((year[i-1]=='0')&&(year[i-2]=='0'))
return 1;
return 0;
}
int div_by_4(char *year)
{
long int sum,i;
i=strlen(year);
sum ...
#include<stdio.h>
#include<string.h>
int div_by_100(char *year)
{
long int i;
i=strlen(year);
if((year[i-1]=='0')&&(year[i-2]=='0'))
return 1;
return 0;
}
int div_by_4(char *year)
{
long int sum,i;
i=strlen(year);
sum ...
- Mon Apr 12, 2010 5:52 pm
- Forum: Volume 3 (300-399)
- Topic: 389 - Basically Speaking
- Replies: 94
- Views: 36776
Re: 389 - 8 months? WA
Thanks a lot sirius.I got ACC.
- Fri Apr 09, 2010 5:49 pm
- Forum: Volume 3 (300-399)
- Topic: 389 - Basically Speaking
- Replies: 94
- Views: 36776
Re: 389 - 8 months? WA
why am i getting WA??
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
void Base_Converter(char *number,int base1,int base2);
void rev_str(char *str);
int main()
{
int base1,base2;
char number[9];
while(scanf("%s %d %d",number,&base1,&base2)!=EOF)
{
Base_Converter ...
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
void Base_Converter(char *number,int base1,int base2);
void rev_str(char *str);
int main()
{
int base1,base2;
char number[9];
while(scanf("%s %d %d",number,&base1,&base2)!=EOF)
{
Base_Converter ...
- Fri Dec 25, 2009 12:11 pm
- Forum: Volume 2 (200-299)
- Topic: 272 - TEX Quotes
- Replies: 136
- Views: 56720
272:Runtime error
Why i am getting runtime errror:
#include<stdio.h>
int main()
{
char ch,line[10000];
int i,q_flag;
q_flag=0;
i=0;
while((ch=getchar())!=EOF)
{
line[i]=ch;
i++;
}
line[i]='\0';
for(i=0;line[i]!='\0';i++)
{
if((line[i]=='"')&&(q_flag==0))
{
q_flag=1;
printf("``");
}
if(q_flag==1 ...
#include<stdio.h>
int main()
{
char ch,line[10000];
int i,q_flag;
q_flag=0;
i=0;
while((ch=getchar())!=EOF)
{
line[i]=ch;
i++;
}
line[i]='\0';
for(i=0;line[i]!='\0';i++)
{
if((line[i]=='"')&&(q_flag==0))
{
q_flag=1;
printf("``");
}
if(q_flag==1 ...
- Fri Dec 18, 2009 8:25 am
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318948
Re: 100
Finally got accepted.
- Sat Nov 21, 2009 2:57 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 318948
Re: 100
Hi,I am new here.Why i am getting RUNTIME ERROR for my code:
#include<stdio.h>
int main()
{
unsigned int m,n,x[20],y[20],i,j,c,mc[20],k,size,t;
i=0;
j=0;
while(scanf("%lu %lu",&x[i],&y[i])==2)
{
if(x[i]>y[i])
{
t=x[i];
x[i]=y[i];
y[i]=t;
}
mc[i]=0;
i++;
}
c=0;
mc[0]=1;
for(j=0;j<i ...
#include<stdio.h>
int main()
{
unsigned int m,n,x[20],y[20],i,j,c,mc[20],k,size,t;
i=0;
j=0;
while(scanf("%lu %lu",&x[i],&y[i])==2)
{
if(x[i]>y[i])
{
t=x[i];
x[i]=y[i];
y[i]=t;
}
mc[i]=0;
i++;
}
c=0;
mc[0]=1;
for(j=0;j<i ...