Search found 2 matches

by perseus
Wed May 19, 2010 11:13 am
Forum: Volume 117 (11700-11799)
Topic: 11776 - Oh Your Royal Greediness!
Replies: 4
Views: 3458

11776 - Oh Your Royal Greediness!

Can anyone tell me what's the problem with the following code? I found nothing wrong.

#include<stdio.h>
#include<stdlib.h>

#define MAX 1002

bool flag[MAX];
struct inter
{
int beg;
int end;
}A[MAX];

int comp(const void *a,const void *b)
{
inter *x = (inter *) a;
inter *y = (inter *) b ...
by perseus
Thu Aug 13, 2009 8:03 am
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 101941

10035 - Primary Arithmetic

What's the problem with my following code. I am getting WA.Please help me.

#include<stdio.h>

int main(){
long m,n,i,j,c,l;

while(scanf("%lld %lld",&m,&n)==2 && (m || n)){
c=0;
l=0;

for(i=m,j=n;i!=0 || j!=0;i/=10,j/=10){
if(i%10+j%10+c>9){
c=1;
l++;
}
}

if(l==0) printf("No carry ...

Go to advanced search