Page 4 of 5

Posted: Thu Nov 24, 2005 11:02 am
by Sakib
yes u r right.

The last month is uayet.

the output of the last input (4. uayet 4999) should be ----------

11 ok 7018 ? isn,t it ?

the outputs are same with yours for the rest.

but WA!!!!!!

i have read other posts , but cant make it ok.
should i post my code ?

Posted: Fri Nov 25, 2005 7:43 am
by Sakib
Here is my code.
Please help me.

Code: Select all


Cut After ACC!

Mamun bhai thanks for helping in advance. :D

Posted: Fri Nov 25, 2005 10:18 am
by mamun
I don't know why you wrote the following line in main()

Code: Select all

if(j == 18)j = j * 5;
Remove it. Let it be just

Code: Select all

j = j * 20;

Posted: Sat Nov 26, 2005 5:31 am
by Sakib
ACC now!

But i thought the last month has only five days.

so at the last case i wanted to count 5.
in other case it is 20.

please explain.

and many many thanks again.

Posted: Sat Nov 26, 2005 5:30 pm
by mamun
Sakib wrote:ACC now!

But i thought the last month has only five days.

so at the last case i wanted to count 5.
in other case it is 20.

please explain.

and many many thanks again.
When you count total number of days you are actually counting how many days are there prior to the beginning of the current month plus the number of days of current month. Note that you return 0 for the first month. So for last month you calculate total number of days before this month (all 20 days) plus number of days of this month.

Posted: Sun Nov 27, 2005 4:54 am
by Sakib
Thanks Mamun Bhai.

I am totally clear now.

300 WA

Posted: Wed Feb 22, 2006 11:44 pm
by IRA
Why do I got WA?
I need some input data and output data to test my program
Please,help!.....

Code: Select all

#include <cstdio>
#include <cstring>

char *Haab[]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char *Tzolkin[]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};

int main()
{
	int num,i;
	int day,year,total,s,k;
	char month[20];

	scanf("%d",&num);
	printf("%d\n",num);
	while(num--)
	{
		scanf("%d. %s %d",&day,month,&year);
		for(i=0;i<=18;i++)
			if(!strcmp(month,Haab[i]))
				break;
		total=i*20+day+1+year*365;
		//total=20;
		s=(total%20==0)?20:total%20;
		//printf("[%d]\n",total);
		printf("%d %s %d\n",(total%13==0)?13:total%13,Tzolkin[s-1],total/260);
	}
	return 0;
}

Posted: Fri Mar 17, 2006 8:17 am
by Raiyan Kamal
a previous post on this problem :
http://online-judge.uva.es/board/viewtopic.php?t=5131

another ( with a good debugging idea ) :
http://online-judge.uva.es/board/viewtopic.php?t=5989

hope it helps

300 WA

Posted: Sat Jun 17, 2006 12:27 am
by farzane
could any one please tell me why got WA on this code:

#include<string.h>
//#include<fstream.h>
#include<iostream.h>

void main(){
// ofstream cout("f:\\my300.out");
// ifstream cin("f:\\300.in");
char habmons[20][10]={
"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh",
"mac","kankin","muan","pax","koyab","cumhu","uayet"};

char tzolkinname[20][10]={"ahau","imix","ik","akbal","kan","chicchan","cimi","manik","lamat",
"muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac"};

long long i,n,year,k,j,day,finaladad,adadperyod,finalyear,mon,mazrab;
char peryod[10],s[10],habmon[10]
;
cin>>n;
cout<<n<<endl;
for(i=0;i<n;i++){
cin>>s;
cin>>habmon;
cin>>year;
for(k=0;k<20;k++)
if(strcmp(habmon,habmons[k])==0){
mon=k;
break;
}

day=mazrab=1;
for(j=strlen(s)-2;j>=0;j--){

day=day+(s[j]-'0')*mazrab;
mazrab*=10;
}
day+=20*mon;
day+=365*year;

finalyear=day/260;
day=day%260;
finaladad=day%13;
if(finaladad==0)finaladad=13;//else finaladad++;
// adadperyod=day;
strcpy(peryod,tzolkinname[day%20]);
cout<<finaladad<<" "<<peryod<<" "<<finalyear<<endl;
}
}

Posted: Fri Jul 14, 2006 5:26 pm
by Raiyan Kamal
a previous post on this problem :
http://online-judge.uva.es/board/viewtopic.php?t=5131

another ( with a good debugging idea ) :
http://online-judge.uva.es/board/viewtopic.php?t=5989

hope it helps

Posted: Fri Jul 14, 2006 7:47 pm
by Darko
I didn't check thouroughly, but I solved it this week, so - what does this do?:

Code: Select all

if(finaladad==0)finaladad=13;//else finaladad++;
first day is 1, not 13, not sure if you are gettigng right answers for the sample input
why not just

Code: Select all

finaladad=(day%13)+1;

300- CE

Posted: Sat Sep 16, 2006 6:56 pm
by vijay03
I submitted the following code in OJ and got compiler error:

Code: Select all

Removed after ACC
The above code compiles on vc++ and gives the correct answer. And in general, what is the source of CEs on OJ?

Posted: Sat Sep 16, 2006 7:37 pm
by mf
I submitted your code as C++, and it has been succesfully compiled.

Did you submit it as a C source? C doesn't have things like "int &d", "int &ny".

why WA?

Posted: Mon Sep 18, 2006 12:57 pm
by vijay03
I submitted it as C++ and it resulted in WA! As far i know, the logic is correct and gives the correct output for all the inputs i gave.. Do i need to change the code so that all the c functions are changed into c++? I thought c++ supported all the c functions..

Posted: Mon Sep 18, 2006 6:19 pm
by mf
There are errors in your lists of names.
For example, you have two "pop" (p[0] and p[15]), and some names are in a wrong order.

Also, instead of all this lengthy strcpy stuff, you can initilialize lists simply with:

Code: Select all

char p[19][10]={"pop","no","zip","zotz",.....};