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

Moderator: Board moderators

gautamzero
New poster
Posts: 32
Joined: Fri Oct 10, 2014 1:10 pm

### Thanks

thank u so much..
i got AC now
None but a fool is always right..
so don't be upset when u r wrong..

New poster
Posts: 11
Joined: Thu Jan 01, 2015 10:31 am

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

brianfry713
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 ...

Delete your post after you get AC.
Check input and AC output for thousands of problems on uDebug!

liya
New poster
Posts: 10
Joined: Fri Jan 23, 2015 2:36 pm

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

getting WA..i need help :

Code: Select all

``````#include<stdio.h>
int main()
{
long long int i,j;
while((scanf("%lld",&i))!=EOF)
{
if((i%4==0&&i%100!=0)||(i%400==0))
{
if(i%15==0&&i%55==0)
{
printf("This is leap year.\n");
printf("This is huluculu festival year.\n");
printf("This is buluculu festival year.\n");
}
else if(i%15==0&&i%55!=0)
{
printf("This is leap year.\n");
printf("This is huluculu festival year.\n");
}
else if(i%55==0&&i%15!=0)
{
printf("This is leap year.\n");
printf("This is buluculu festival year.\n");
}
else
{
printf("This is leap year.\n");
}
}
else
{
if(i%55==0&&i%15!=0)
{
printf("This is buluculu festival year.\n");
}
else if(i%55!=0&&i%15==0)
{
printf("This is huluculu festival year.\n");
}
else if(i%55==0&&i%15==0)
{
printf("This is huluculu festival year.\n");
printf("This is buluculu festival year.\n");

}
else
{
printf("This is an ordinary year.\n");
}
}

}
return 0;
}``````

Helaluddin_brur
New poster
Posts: 15
Joined: Tue Oct 21, 2014 4:08 pm
Contact:

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

removed after ac

mh_sagar
New poster
Posts: 1
Joined: Sat Apr 09, 2016 5:09 pm

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

whats wrong with my code

Code: Select all

``````#include<stdio.h>

int main()
{
int year;
while(scanf("%d",&year)!=EOF){

if(year<2000){
printf("Year should be greater than 2000\n");
}
else{
if(year%400==0 || (year%100!=0 && year%4==0)){
printf("This is a leap year\n");
}
else{
printf("This is a ordinary year\n");
}
if(year%15==0){
printf("This is huluculu festival year\n");
}
if(year%55==0){
printf("This is Bulukulu festival year\n");
}
}
}
return 0;
}
``````

monir004
New poster
Posts: 1
Joined: Tue Jun 07, 2016 12:17 pm

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

Should i use string to solve this problem?

New poster
Posts: 2
Joined: Thu Jun 09, 2016 12:01 pm

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

I have gotten many many WAs. I have checked with almost all the inputs from uDebug and this forum and passed. But the judge think otherwise. I am unable to find any problem. Here is my code. Please help!

Code: Select all

``````#include <stdio.h>

int y[1000000];

int main() {
char c;
register int l = 0, div11 = 0, div3 = 0;
while (c = getchar()) {
if (c > 47 && c < 58) {
int d = c - 48;
y[l] = d;
div3 += d;
if ((l % 2) == 0) {
div11 += d;
} else {
div11 -= d;
}
++l;
} else if (c == 10 || c == EOF) {
int s = 0, ls = 0;
if (((y[l - 4] * 10 + y[l - 3]) % 4 == 0) && (y[l - 2] == 0) && (y[l - 1] == 0)) {
printf("This is leap year.\n");
s = ls = 1;
} else if ((y[l - 1] == 0) && (y[l - 2] == 0)) {
s = 0, ls = 0;
} else if ((y[l - 2] * 10 + y[l - 1]) % 4 == 0) {
printf("This is leap year.\n");
s = ls = 1;
} else {
s = 0, ls = 0;
}
if ((div3 % 3 == 0) && (y[l - 1] == 5 || y[l - 1] == 0)) {
printf("This is huluculu festival year.\n");
s = 1;
}
if (ls && (div11 % 11 == 0) && (y[l - 1] == 5 || y[l - 1] == 0)) {
printf("This is bulukulu festival year.\n");
s = 1;
}
if (!s)printf("This is an ordinary year.\n");
if (c != EOF) {
putchar(10);
} else {
break;
}
div3 = 0, div11 = 0, l = 0;
}
}
return 0;
}``````

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

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

Try running your code on the sample input. Your output doesn't match sample output.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman