Page 6 of 16
10070 why wa.Please give critical input, output
Posted: Thu Jun 22, 2006 9:09 am
by SHAHADAT
Hi,
I have got wa 10070.Please give me critical input output.
Posted: Thu Jun 22, 2006 9:48 am
by ayon
didn't you read this topic?
http://online-judge.uva.es/board/viewto ... ight=10070
use "search" button, that'll help you, and for 10070 you must use bigNum.
Posted: Thu Jun 22, 2006 6:42 pm
by emotional blind
bigNum is not necessery,
There is number theory.
Posted: Fri Jun 23, 2006 11:16 am
by ayon
emotional blind wrote:bigNum is not necessery,
There is number theory.
thats right, this problem can be solved using only number theory, i meant that the input year must be taken as bigNum, not as int or long long
Posted: Sat Jun 24, 2006 12:43 pm
by SHAHADAT
Thanks a lot all of you.
I got it accepted....................
-----------------------------------------------------------------
Programming is nothing but self examining.
10070,WA & WA &....!!!
Posted: Fri Jun 30, 2006 1:27 pm
by deena sultana
hi,
i m getting wa in the 10070 for several times. i did some corrections bt still it is WA.
Any1 there 2 help me, pz?
here is my code:
Code: Select all
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
int main()
{
int flag,count,len,n1,n2,n3,n4,odd,even;
char num1[5],y[10001],num2[5];
while(gets(y))
{
len=strlen(y);
flag=count=0;
num1[0]=y[len-2];
num1[1]=y[len-1];
num1[2]='\0';
n1=atoi(num1);
num2[0]=y[len-4];
num2[1]=y[len-3];
num2[2]='\0';
n4=atoi(num2);
//cout<<"n1 "<<n1<<" ";
if(((y[len-1]=='0' && y[len-2]=='0') && n4%4==0) || ((y[len-1]!='0' && y[len-2]!='0')&& n1%4==0)){
{
cout<<"This is leap year."<<endl;
flag++;
count++;}}
n2=0;
for(int i=0;i<len;i++)
n2+=y[i]-'0';
//cout<<"n2 "<<n2<<" ";
if(n2%3==0 && (y[len-1]=='0' || y[len-1]=='5')){
cout<<"This is huluculu festival year."<<endl;
flag++;}
odd=even=0;
for(int i=0;i<len;i+=2)
odd+=y[i]-'0';
for(int i=1;i<len;i+=2)
even+=y[i]-'0';
n3=abs(odd-even);
// cout<<"n3 "<<n3<<" ";
if(count>0 && (n3==0 || n3==11) && (y[len-1]=='0' || y[len-1]=='5'))
{
cout<<"This is bulukulu festival year."<<endl;
flag++;
}
if(flag==0)
cout<<"This is an ordinary year."<<endl;
cout<<endl;
}
return 0;
}
I need ur help.
10070,WA & WA &....!!!
Posted: Fri Jun 30, 2006 1:29 pm
by deena sultana
hi,
i m getting wa in the 10070 for several times. i did some corrections bt still it is WA.
Any1 there 2 help me, plz?
here is my code:
I need ur help.
Posted: Fri Jun 30, 2006 3:29 pm
by sohel
hello-
I don't think you are handling the leap year property correctly..
A line from the problem statement..
A year that is divisible by 4 and not divisible by 100 with the exception that years that are divisible by 400 are also leap year.
it means:
if( year % 400 == 0 ) leap_year;
else if( year % 100 == 0 ) not_leap_year;
else if( year % 4 == 0 ) leap_year;
else not_leap_year.
so, the year 2404 is a leap_year... but your code seems to think otherwise.
# And there are several other threads related to this topic. You should posted a reply on those, rather than opening a new thread..
Hope it helps..

Still WA
Posted: Fri Jun 30, 2006 9:33 pm
by deena sultana
dear sohel,
thanks for ur help. i was very much cofused abt that line.
now i made a correction but still it's gettin WA.
sohel, thanks again.
i dont know what to do. Any1 help me again?
my correction copy is here:
plz help, plzzzzzzzzzz.
Posted: Fri Jun 30, 2006 10:00 pm
by deena sultana
Sohel,
u r really gr8.
i m thanking u 4m my heart.
i get AC at last . thank u so much.

WA
Posted: Mon Jul 10, 2006 11:04 pm
by pankaj trivedi
here is my code ..i m getting WA ...please help!!
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
bool four(string s)
{ int n=s.length();
int a,b,c;
a=s[n-1]-'0';
b=s[n-2]-'0';
c=10*b+a;
if(c%4==0)
return true;
else
return false;
}
bool five(string s)
{
int n=s.length();
int a;
a=s[n-1]-'0';
if(a==5 || a==0)
return true;
else
return false;
}
bool hundred(string s)
{ int n=s.length();
int a,b,c;
a=s[n-1]-'0';
b=s[n-2]-'0';
if(a==0 && b==0)
return true;
else
return false;
}
bool eleven(string s)
{int n=s.length();
int a,b,c;
int sum1=0,sum2=0,sum=0;
for(int i=0;i<n;++i)
{ sum+=s
-'0';}
for(int i=n-1;i>=0;i=i-2)
{ sum1=sum1+s-'0';}
sum2=sum-sum1;
if(abs(sum1-sum2) %11==0)
return true;
else
return false;
}
bool three(string s)
{int n=s.length();
int sum1=0,sum2=0,sum=0;
for(int i=0;i<n;++i)
{ sum+=s-'0';}
if(sum%3==0)
return true;
else
return false;
}
main()
{
string y;
while(cin>>y)
{bool flag=false;
bool check=false;
if(four(y)==true && hundred(y)==true)
{ cout<<"This is leap year."<<endl;
flag=true;
check=true;}
else if(four(y)==true && hundred(y)==false)
{cout<<"This is leap year."<<endl;
flag=true;
check=true;
}
if(five(y)==true && three(y)==true)
{ cout<<"This is huluculu festival year."<<endl;
check=true;}
if(flag==true && eleven(y)==true && five(y)==true)
{cout<<"This is bulukulu festival year."<<endl;
check=true;}
if(!check)
cout<<"This is an ordinary year."<<endl;
cout<<endl;
}
}
Posted: Mon Jul 10, 2006 11:07 pm
by vinit_iiita
what's the error why WR
help me out.................[/b][/b]
Posted: Wed Jul 12, 2006 7:40 pm
by ayon
buluculu or bulukulu ???
Posted: Thu Jul 13, 2006 1:38 pm
by vinit_iiita
thanks a lot..... i got accepted. this is my way of making damn sily mistakes..
10070 Why wa.
Posted: Fri Aug 04, 2006 10:19 pm
by 898989