Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求哪位大神帮我看看什么地方出错了?测试数据都对了,还是WA,已纠结两天了!

Posted by 1284810986 at 2014-11-01 20:45:02 on Problem 1008
代码有点渣,不要介意啊
#include<iostream>
#include<string>
using namespace std;
int main()
{
	enum Dayname{imix=1, ik, akbal, kan, chicchan, cimi, manik, lamat, muluk, ok, chuen, eb, ben, ix, mem, cib, caban, eznab, canac, ahau};
	Dayname dayname;
string month;
int day,year,month1;
int x,i,sum,y;
char a;
cin>>x;    //测试的数据数
cout<<x<<endl;
for(i=0;i<x;i++)
{
cin>>day>>a>>month>>year;
if(month=="pop") month1=1;
else if(month=="no") month1=2;
else if(month=="zip") month1=3;
else if(month=="zotz") month1=4;
else if(month=="tzec") month1=5;
else if(month=="xul") month1=6;
else if(month=="yoxkin") month1=7;
else if(month=="mol") month1=8;
else if(month=="chen") month1=9;
else if(month=="yax") month1=10;
else if(month=="zac") month1=11;
else if(month=="ceh") month1=12;
else if(month=="mac") month1=13;
else if(month=="kankin") month1=14;
else if(month=="muan") month1=15;
else if(month=="pax") month1=16;
else if(month=="koyab") month1=17;
else if(month=="cumhu") month1=18;
else if(month=="uayet") month1=19;
sum=year*365+day+1+(month1-1)*20;  //计算总天数
year=sum/260;   //计算年数
sum=sum%260;    
if(sum%13==0)      //输出天数字
{cout<<"13"<<" ";
year=year-1;}
else
cout<<sum%13<<" ";
dayname=Dayname(sum%20);
switch(dayname)     //输出天名称
{
case 1: cout<<"imix";break;
case 2: cout<<"ik";break;
case 3: cout<<"akbal";break;
case 4: cout<<"kan";break;
case 5: cout<<"chicchan";break;
case 6: cout<<"cimi";break;
case 7: cout<<"manik";break;
case 8: cout<<"lamat";break;
case 9: cout<<"muluk";break;
case 10: cout<<"ok";break;
case 11: cout<<"chuen";break;
case 12: cout<<"eb";break;
case 13: cout<<"ben";break;
case 14: cout<<"ix";break;
case 15: cout<<"mem";break;
case 16: cout<<"cib";break;
case 17: cout<<"caban";break;
case 18: cout<<"eznab";break;
case 19: cout<<"canac";break;
case 0: cout<<"ahau";break;
default: break;
}
cout<<" "<<year<<endl;    //输出年数
}
return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator