... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...

Friday, January 24, 2014

UVA-10070 : Leap Year or Not Leap Year

//Problem link>>http://uva.onlinejudge.org/external/100/10070.html


#include <bits/stdc++.h>
using namespace std ;

string s="" ;
int len ;

int check ( int n)
{
    int i  , x=0 ;
    for (i=0 ; i<len ; i++) x= (x*10+(s[i]-'0') )%n ;
    if (x==0) return 0 ;
    else return 1 ;
}

int main ()
{
    int  i , t=0 ;
    while (cin>>s )
    {
        len=s.size() ;
         if (t!=0) cout<<endl ;
            t=1 ;

        int  a=0, b=0 ,c=0 ,d=0 , e=0 , lp=0 ,op=0 ;

        a = check (4) ;
        b = check (100) ;
        c = check (400) ;
        d = check (15) ;
        e = check (55) ;

        if ( (a==0 && b!=0) || c==0 )
        {
            cout<<"This is leap year."<<endl ;
            lp=1 ;
            op=1 ;
        }

        if (d==0)
        {
            cout<<"This is huluculu festival year."<<endl ;
            op=1 ;
        }
        if (e==0 && lp==1)  cout<<"This is bulukulu festival year."<<endl ;

        else if (op==0)  cout<<"This is an ordinary year."<<endl ;

    }

    return 0 ;
}

No comments:

Post a Comment