10070 - Leap Year or Not Leap Year and ...
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10070 - Leap Year or Not Leap Year and …
Maybe year is longer than 10000 digits.
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 87
- Joined: Thu Dec 15, 2011 3:08 pm
- Location: University of Rajshahi,Bangladesh
Re: 10070 - Leap Year or Not Leap Year and …
I made it 100000000 but also WAAAAA!!!!!brianfry713 wrote:Maybe year is longer than 10000 digits.
we r surrounded by happiness
need eyes to feel it!
need eyes to feel it!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10070 - Leap Year or Not Leap Year and …
Post your updated code.
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 87
- Joined: Thu Dec 15, 2011 3:08 pm
- Location: University of Rajshahi,Bangladesh
Re: 10070 - Leap Year or Not Leap Year and …
cutt.....After AC
Last edited by mahade hasan on Wed Jun 13, 2012 7:27 am, edited 1 time in total.
we r surrounded by happiness
need eyes to feel it!
need eyes to feel it!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10070 - Leap Year or Not Leap Year and …
Bulukulu festival (Happens on years divisible by 55 provided that is also a leap year)
16555 is an ordinary year.
16555 is an ordinary year.
Check input and AC output for thousands of problems on uDebug!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10070 - Leap Year or Not Leap Year and …
My AC code assumes each line has a max of 1000000 characters.
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 87
- Joined: Thu Dec 15, 2011 3:08 pm
- Location: University of Rajshahi,Bangladesh
Re: 10070 - Leap Year or Not Leap Year and …
thanks ......it's work,thanks a lot!!brianfry713 wrote:Bulukulu festival (Happens on years divisible by 55 provided that is also a leap year)
16555 is an ordinary year.
we r surrounded by happiness
need eyes to feel it!
need eyes to feel it!
10070 - Leap Year or Not Leap Year and ...
Getting WA...plz help me find the error in my code:-
Code: Select all
Code removed after AC
Last edited by @ce on Mon Jun 25, 2012 10:02 am, edited 2 times in total.
-@ce
Re: 10070 - Leap Year or Not Leap Year and …
I checked my output with previous I/O. My prog accepts MAX 1000000 chars. Still WA.
Code: Select all
#include<stdio.h>
#include<cstring>
#define MAX 1000000
int main()
{
char year[MAX + 10];
bool first = true;
while(scanf("%s",year) != EOF)
{
bool leap = false, hulu = false, bulu = false;
int len = strlen(year);
int a = year[len - 2] - '0';
a = a * 10 + year[len-1] - '0';
int b = year[len - 4] - '0';
b = b * 10 + year[len-3];
if(a == 0 && b % 4 == 0)
leap = true;
else if(a && a % 4 == 0)
leap = true;
int sum = 0, altsum = 0;
for(int i = 0;i < len;i++)
{
sum = sum + year[i] - '0';
if(i % 2 == 0)
altsum = altsum + year[i] - '0';
else
altsum = altsum - year[i] + '0';
}
if( (year[len-1] == '0' || year[len-1] == '5') && sum % 3 == 0 )
hulu = true;
if(leap && (year[len-1] == '0' || year[len-1] == '5') && altsum % 11 == 0)
bulu = true;
if(!first)
printf("\n");
first = false;
if(leap)
printf("This is a leap year.\n");
if(hulu)
printf("This is huluculu festival year.\n");
if(bulu)
printf("This is bulukulu festival year.\n");
if(!leap && !hulu && !bulu)
printf("This is an ordinary year.\n");
}
return 0;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10070 - Leap Year or Not Leap Year and ...
A line may be longer than 1000 digits. My AC code assumes a line can be 1000000 digits long.
Check input and AC output for thousands of problems on uDebug!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10070 - Leap Year or Not Leap Year and …
"This is leap year.", not "This is a leap year."
Check input and AC output for thousands of problems on uDebug!
Re: 10070 - Leap Year or Not Leap Year and ...
yeah..thanks a lot brianfry for pointing out....i got AC 

-@ce
10070 - Leap Year or Not Leap Year and …
my code is :
#include<stdio.h>
#include<string.h>
int main()
{
char y[1000000];
while(gets(y))
{
long i,n,a4=0,a15=0,a55=0,a100=0,a400=0;
i=0;
n=strlen(y);
while(i<n)
{
y=y-48;
a4=(a4*10+y)%4;
a15=(a15*10+y)%15;
a55=(a55*10+y)%55;
a100=(a100*10+y)%100;
a400=(a400*10+y)%400;
i++;
}
if((a4==0&&a100!=0)||a400==0)
{
printf("This is leap year.\n");
if(a15==0)
printf("This is huluculu festival year.\n");
if(a55==0)
printf("This is bulukulu festival year.\n");
}
else
{
if(a15==0)
printf("This is huluculu festival year.\n");
else
printf("This is an ordinary year.\n");
}
printf("\n");
}
return 0;
}
getting WA again and again !!!
plz help meeee ......
#include<stdio.h>
#include<string.h>
int main()
{
char y[1000000];
while(gets(y))
{
long i,n,a4=0,a15=0,a55=0,a100=0,a400=0;
i=0;
n=strlen(y);
while(i<n)
{
y=y-48;
a4=(a4*10+y)%4;
a15=(a15*10+y)%15;
a55=(a55*10+y)%55;
a100=(a100*10+y)%100;
a400=(a400*10+y)%400;
i++;
}
if((a4==0&&a100!=0)||a400==0)
{
printf("This is leap year.\n");
if(a15==0)
printf("This is huluculu festival year.\n");
if(a55==0)
printf("This is bulukulu festival year.\n");
}
else
{
if(a15==0)
printf("This is huluculu festival year.\n");
else
printf("This is an ordinary year.\n");
}
printf("\n");
}
return 0;
}
getting WA again and again !!!

10070 - Leap Year WA but y ???
plz help ,,, here's my code :
#include<stdio.h>
#include<string.h>
int main()
{
char y[100];
while(gets(y))
{
int i,n,a4=0,a15=0,a55=0,a100=0,a400=0;
i=0;
n=strlen(y);
while(i<n)
{
y=y-48;
a4=(a4*10+y)%4;
a15=(a15*10+y)%15;
a55=(a55*10+y)%55;
a100=(a100*10+y)%100;
a400=(a400*10+y)%400;
i++;
}
if((a4==0&&a100!=0)||a400==0)
{
printf("This is leap year.\n");
if(a15==0)
printf("This is huluculu festival year.\n");
if(a55==0)
printf("This is bulukulu festival year.\n");
}
else
{
if(a15==0)
printf("This is huluculu festival year.\n");
else
printf("This is an ordinary year.\n");
}
printf("\n");
}
return 0;
}
plz help me ....
#include<stdio.h>
#include<string.h>
int main()
{
char y[100];
while(gets(y))
{
int i,n,a4=0,a15=0,a55=0,a100=0,a400=0;
i=0;
n=strlen(y);
while(i<n)
{
y=y-48;
a4=(a4*10+y)%4;
a15=(a15*10+y)%15;
a55=(a55*10+y)%55;
a100=(a100*10+y)%100;
a400=(a400*10+y)%400;
i++;
}
if((a4==0&&a100!=0)||a400==0)
{
printf("This is leap year.\n");
if(a15==0)
printf("This is huluculu festival year.\n");
if(a55==0)
printf("This is bulukulu festival year.\n");
}
else
{
if(a15==0)
printf("This is huluculu festival year.\n");
else
printf("This is an ordinary year.\n");
}
printf("\n");
}
return 0;
}
plz help me ....
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10070 - Leap Year or Not Leap Year and …
Don't print an extra blank line at the end of the output.
Check input and AC output for thousands of problems on uDebug!