Page 10 of 16

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Fri Jun 01, 2012 1:16 am
by brianfry713
Maybe year is longer than 10000 digits.

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Tue Jun 05, 2012 7:26 pm
by mahade hasan
brianfry713 wrote:Maybe year is longer than 10000 digits.
I made it 100000000 but also WAAAAA!!!!!

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Tue Jun 05, 2012 9:16 pm
by brianfry713
Post your updated code.

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Mon Jun 11, 2012 7:10 pm
by mahade hasan
cutt.....After AC

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Tue Jun 12, 2012 12:11 am
by brianfry713
Bulukulu festival (Happens on years divisible by 55 provided that is also a leap year)
16555 is an ordinary year.

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Tue Jun 12, 2012 12:12 am
by brianfry713
My AC code assumes each line has a max of 1000000 characters.

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Wed Jun 13, 2012 7:28 am
by mahade hasan
brianfry713 wrote:Bulukulu festival (Happens on years divisible by 55 provided that is also a leap year)
16555 is an ordinary year.
thanks ......it's work,thanks a lot!!

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

Posted: Fri Jun 15, 2012 2:12 pm
by @ce
Getting WA...plz help me find the error in my code:-

Code: Select all

Code removed after AC

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Fri Jun 15, 2012 2:22 pm
by mathgirl
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;
}

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

Posted: Fri Jun 15, 2012 9:06 pm
by brianfry713
A line may be longer than 1000 digits. My AC code assumes a line can be 1000000 digits long.

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Fri Jun 15, 2012 9:08 pm
by brianfry713
"This is leap year.", not "This is a leap year."

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

Posted: Fri Jun 15, 2012 9:47 pm
by @ce
yeah..thanks a lot brianfry for pointing out....i got AC :)

10070 - Leap Year or Not Leap Year and …

Posted: Fri Jul 06, 2012 3:16 pm
by sonjbond
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 ......

10070 - Leap Year WA but y ???

Posted: Mon Jul 09, 2012 4:55 am
by sonjbond
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 ....

Re: 10070 - Leap Year or Not Leap Year and …

Posted: Tue Jul 17, 2012 1:32 am
by brianfry713
Don't print an extra blank line at the end of the output.