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

All about problems in Volume 100. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

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

Thanks

Post by gautamzero » Fri Oct 10, 2014 6:45 pm

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

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

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

Post by uradura » Mon Jan 12, 2015 7:09 am


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

Post by brianfry713 » Tue Jan 13, 2015 12:19 am

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

Post by liya » Mon Jul 06, 2015 9:13 am

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
Location: Bangladesh
Contact:

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

Post by Helaluddin_brur » Fri Aug 21, 2015 4:35 am

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

Post by mh_sagar » Sat Apr 09, 2016 5:15 pm

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

Post by monir004 » Sun Jun 12, 2016 1:53 pm

Should i use string to solve this problem?

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

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

Post by altair_ibn_la_ahad » Thu Oct 06, 2016 10:46 am

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

Post by lighted » Tue Mar 14, 2017 1:59 pm

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

Post Reply

Return to “Volume 100 (10000-10099)”

Who is online

Users browsing this forum: No registered users and 1 guest