Page 5 of 16

10070 - Leap Year or Not Leap Year and...

Posted: Mon Jul 11, 2005 8:29 pm
by helloneo

Code: Select all

code removed
i got WA..
any advice..?

Posted: Tue Jul 12, 2005 6:40 am
by chunyi81
If you have searched through this forum, you would have found the solution to your problem. The input does not fit into an int, nor long nor long long. You have to use strings.

Search through this forum for 10070 for past threads to this problem. Hope this helps.

Posted: Tue Jul 12, 2005 10:28 am
by sohel
to helloneo:
your author id seems to be very familiar..
... oh! wait a sec. It's my uva ID.

Posted: Tue Jul 12, 2005 5:13 pm
by helloneo
thanks..
then i really have to study BIG INTEGER.. ^^

and what a coincidence.. sohel.. ~

Posted: Wed Jul 13, 2005 7:12 am
by shamim
sohel wrote:to helloneo:
your author id seems to be very familiar..
... oh! wait a sec. It's my uva ID.
Sohel, how is it your uva ID :-?

10070 again!!

Posted: Thu Oct 13, 2005 7:04 am
by mmij
hi,
i've read all topics about 10070 and all sample matches with my output....
but still WA?? plz plz plz anybody findout bug in my code or give me some critical input.
tanx

Code: Select all

//got acc :lol: 

Re: 10070 again!!

Posted: Thu Oct 13, 2005 9:24 am
by tan_Yui
Hi, mmij.
Although your algorithm is correct, there is incorrect part caused by careless mistake.

Check the word 'festival' in your code.
After fixed, you'll get Accepted in nice CPU Time. :)

Best regards.

Posted: Fri Oct 14, 2005 8:02 am
by mmij
thanks tan.
next time i should be careful with spelling :roll:

10070 WA

Posted: Sat Jan 07, 2006 4:08 pm
by Munni
Can anuone give me some critical I/O. I can't fix the bug o my code.plz help me.


/*My code */

#include<stdio.h>
#include<iostream.h>
#include<string.h>
#include<math.h>
int checkleap(char year[])
{

int len,check1=0,check2=0,i,j;
long int sum1=0,sum2=0;
len=strlen(year);
if(year[len-2]=='0'&&year[len-1]=='0')
check1=1;
for(i=0,j=len-1;i<2;i++,j--)
sum1+=(year[j]-48)*pow(10,i);

if(sum1%4==0)
check2=1;
if(!check1&&check2)
return 1;
for(i=0,j=len-3;i<2;j--,i++)
sum2+=(year[j]-48)*pow(10,i);

if(check1&&((sum2%4)==0))
return 1;
else
return 0;


}
int checkbul(char year[])
{


int len,check1=0,check2=0,i,j;
long int sum1=0,sum2=0;
len=strlen(year);
if(year[len-1]=='0'||year[len-1]=='5')
check1=1;
if((len%2)==0)
{
for(i=0;i<=len-2;i=i+2)
sum1+= year-48;

for(j=1;j<=len-1;j=j+2)
sum2+= year[j]-48;
}
else
{
for(i=0;i<=len-1;i=i+2)
sum1+= year-48;

for(j=1;j<=len-2;j=j+2)
sum2+= year[j]-48;

}

if(((sum1-sum2)%11)==0)
check2=1;

if(check1&&check2)
return 1;
else
return 0;






}





int checkhul(char year[])

{

int len,check1=0,check2=0,i;
long int sum1=0;
len=strlen(year);

if(year[len-1]=='0'||year[len-1]=='5')
check1=1;


for(i=0;i<len;i++)
sum1+=year-48;
if((sum1%3)==0)

check2=1;


if(check1&&check2)
return 1;
else
return 0;



}


int main(void)
{
char year[50000];
int l,h,b=0,count=0;
while(gets(year))
{
if(count)
cout<<"\n";
l=checkleap(year);
h=checkhul(year);

if(l)
{
cout<<"This is leap year.\n";
b=checkbul(year);
if(b)
cout<<"This is buluculu festival year.\n";
b=0;

}

if(h)
cout<<"This is huluculu festival year.\n";

if(!l&&!h&&!b)
cout<<"This is an ordinary year.\n";
count++;

}



return 0;






}

Posted: Sat Jan 07, 2006 5:08 pm
by Solaris
check the spelling "buluculu".. :wink:

It took me 1 hour to find this bug in my own code :P

Posted: Sat Jan 07, 2006 7:16 pm
by Munni
Many many thnks to u.There was another prblmin my code.At last fix it nd got AC.Thnks again.

10070 WA

Posted: Tue Jan 24, 2006 6:06 am
by tmdrbs6584
#include<iostream.h>
int main(){
long long int a;
while(cin >> a){
if(a%4==0){
if(a%400==0){
cout << "This is leap year." << endl;
}
else if(a%100==0)
cout << "This is an ordinary year." << endl;
else{
cout << "This is leap year." << endl;
}
}
else
cout << "This is an ordinary year." << endl;
if(a%15==0){
cout << "This is huluculu festival year." << endl;
}
if(a%4==0){
if(a%400==0){
if(a%55==0)
cout << "This is bulukulu festival year." << endl;
}
else if(a%100==0){}
else{
if(a%55==0)
cout << "This is bulukulu festival year." << endl;
}
}
cout << endl;
}
return 0;
}
Why WA?

Posted: Tue Jan 24, 2006 6:41 am
by helloneo
input is very very large.. doesn't even fit in 64 bit integer..

10070 WA Help........

Posted: Sun Jan 29, 2006 10:51 am
by tot
Ye,I've just got it~Thanks!
^_^

&#47336;&#47336;&#47336;

Posted: Mon Jan 30, 2006 1:28 pm
by tmdrbs6584
왜 올렸는지
ㅡ,.ㅡ;;