Page 11 of 16
10070 why wa?
Posted: Sun Jul 22, 2012 1:52 pm
by Honour_00
removed
Re: 10070 why wa?
Posted: Mon Jul 23, 2012 11:28 pm
by brianfry713
Don't print a blank line at the end of the output.
Re: 10070 why wa?
Posted: Tue Jul 24, 2012 6:32 pm
by Honour_00
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
using namespace std;
int main()
{
long long a,s,d,f,g,h,j,k,l,e,E,q,c3,c11,Q,kk,w,ww,qq,ee,rr,tt,yy,iii,iiii,iiiii,uu,u;
string aa;
while(cin>>aa)
{
int leap=0,bulu=0,hulu=0;
a=aa.size();
if(a<5)
{
qq=5-a;
for(ww=0;ww<=qq;ww++)
{
aa="0"+aa;
}
}
a=aa.size();
ee=0;rr=0;
int oo=1;
for(tt=a-1;;tt--)
{
yy=(int)(aa[tt]-'0');
ee=ee+yy*oo;
rr++;
oo=oo*10;
if(rr==4) break;
}
e=0;E=0;
for(q=a-1;q>=0;q=q-2)
{
char l=aa[q];
e=e+(int)(l-'0');
}
for(Q=a-2;Q>=0;Q=Q-2)
{
char L=aa[Q];
E=E+(int)(L-'0');
}
k=ee;
if((k%4==0 && k%100!=0) || (k%400==0))
{
leap=1;
}
c3=e+E;
c11=e-E;
s=(int)(aa[a-1]-'0');
if((s==5 || s==0) && (c3%3==0))
{
hulu=1;
}
if(leap==1)
{
if((s==5 || s==0) && ((c11%11)==0))
{
bulu=1;
}
}
if(leap==1) printf("This is leap year.\n");
if(hulu==1) printf("This is huluculu festival year.\n");
if(bulu==1) printf("This is bulukulu festival year.\n");
if(leap==0 && hulu==0 && bulu==0) printf("This is an ordinary year.\n");
}
return 0;
}
what should this problem be called.
disappointing or embarrassing

Re: 10070 why wa?
Posted: Tue Jul 24, 2012 7:04 pm
by outsbook
Print blank line between two cases.
like this
Input:
Output:
Code: Select all
This is leap year.
This is huluculu festival year.
This is bulukulu festival year.
This is leap year.
This is huluculu festival year.
This is bulukulu festival year.
But your output:
Code: Select all
This is leap year.
This is huluculu festival year.
This is bulukulu festival year.
This is leap year.
This is huluculu festival year.
This is bulukulu festival year.
Do not forget, remove your code after accept.
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Fri Oct 26, 2012 3:33 pm
by gr81
removed AC code.
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Sat Oct 27, 2012 12:35 am
by brianfry713
Try getting rid of these lines:
Code: Select all
if (atoi(lstr.c_str()) < 2000)
continue;
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Sat Oct 27, 2012 12:44 am
by gr81
i resubmitted the code after removing the following lines....still WA ?
any more suggestion where i can look...
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Sat Oct 27, 2012 12:36 pm
by gr81
it is bulukulu not buluculu....
thanks..
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Fri Nov 30, 2012 2:00 am
by mahbub2012
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Fri Nov 30, 2012 6:42 am
by brianfry713
Don't print an extra blank line at the end of the output.
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Fri Nov 30, 2012 12:58 pm
by mahbub2012
Thank you brianfry713.
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Sat Dec 08, 2012 2:14 am
by brianfry713
A blank line should separate the output for each line of input.
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Fri Mar 01, 2013 6:20 pm
by tamimcsedu19
My code does provide all the sample output. but where it is wrong. code is
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Fri Mar 01, 2013 7:54 pm
by lbv
tamimcsedu19 wrote:My code does provide all the sample output. but where it is wrong
Code: Select all
[/quote]
Notice the following statement, from the [i]Output[/i] specification: "A blank line should separate the output for each line of input".
Maybe it could have been expressed a little better, but you can see that it says that blank lines should be used to [i]separate[/i] the output from different cases. So, make sure you don't print a blank line after the last test case. But make sure you do print a newline (\n) at the end of each line, which you're not doing in the "bulukulu festival" case.
Re: 10070 - Leap Year or Not Leap Year and …
Posted: Sun Mar 10, 2013 7:33 pm
by hello
#include<stdio.h>
#include<string.h>
int main()
{
int c15,c55,c100,c400,c4,ct=1,l,r,t;
char arr[100000];
while(scanf("%s",arr)==1)
{
int i,k,q=0,rem=0,m=0,w;
i=strlen(arr);
for(k=0; k<i; k++)
{
rem=rem*10;
rem+=arr[k]-48;
rem=rem%55;
q=q*10;
q+=arr[k]-48;
q=q%4;
m=m+arr[k]-48;
}
if (rem==0)c55=1; else c55=0;
if (q==0)c4=1;else c4=0;
if(m%3==0&&(arr[i-1]=='5' || arr[i-1]=='0'))c15=1;else c15=0;
if(arr[i-1]=='0'&&arr[i-2]=='0')c100=1;else c100=0;
w=arr[i-3]*100+arr[i-2]*10+arr[i-1];
if(w%4==0 || 1==0)c400=1;else c400=0;
r=0;
if(ct!=1)printf("\n");
if(c4 && (!c100||c400)){r=1;printf("This is leap year.\n");}
if(c15)printf("This is huluculu festival year.\n");
if(r && c55)printf("This is bulukulu festival year.\n");
if(r==0 && c15==0)printf("This is an ordinary year.\n");
ct++;
}
return 0;
}
Why got WA......please help.....