北大的ACM题库中1008题为什么提交时总是Wrong Answer,测试时的程序可以通过啊,代码如下,有劳大虾救助
#include<iostream>usingnamespacestd;#include<string.h>intTransHaab(char*NofM){if(strc...
#include<iostream>
using namespace std;
#include<string.h>
int TransHaab(char *NofM)
{
if(strcmp(NofM,"pop")==0)
return 1;
if(strcmp(NofM,"no")==0)
return 2;
if(strcmp(NofM," zip")==0)
return 3;
if(strcmp(NofM,"zotz")==0)
return 4;
if(strcmp(NofM,"tzec")==0)
return 5;
if(strcmp(NofM,"xul")==0)
return 6;
if(strcmp(NofM,"yoxkin")==0)
return 7;
if(strcmp(NofM,"mol")==0)
return 8;
if(strcmp(NofM,"chen")==0)
return 9;
if(strcmp(NofM,"yax")==0)
return 10;
if(strcmp(NofM,"zac")==0)
return 11;
if(strcmp(NofM,"ceh")==0)
return 12;
if(strcmp(NofM,"mac")==0)
return 13;
if(strcmp(NofM,"kankin")==0)
return 14;
if(strcmp(NofM,"muan")==0)
return 15;
if(strcmp(NofM,"pax")==0)
return 16;
if(strcmp(NofM,"koyab")==0)
return 17;
if(strcmp(NofM,"cumhu")==0)
return 18;
if(strcmp(NofM,"uayet")==0)
return 19;
}
void TransTzd(int NofD)
{
switch(NofD)
{
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 20:cout<<"ahau";break;
}
}
int daycount(int DNum,char *NofM,int Hyears)
{
long month,counts;
month=TransHaab(NofM);
counts=Hyears*365+(month-1)*20+DNum+1;
return counts;
}
void TransCalender(long dcount)
{
long years,num,mod,NofD;
years=dcount/260;
mod=dcount%260;
num=mod%13;
if(num==0)
num=13;
NofD=mod%20;
if(NofD==0)
NofD=20;
cout<<num<<' ';
TransTzd(NofD);
cout<<' '<<years<<endl;
}
int main()
{
long m,DNum,Hyears;
char temp;
static char NofM[15];
long dcount[60000];
cin>>m;
for(int i=0;i<m;i++)
{
cin>>DNum>>temp>>NofM>>Hyears;
dcount[i]=daycount(DNum,NofM,Hyears);
}
cout<<m<<endl;
for(int k=0;k<m;k++)
{
TransCalender(dcount[k]);
}
return 0;
} 展开
using namespace std;
#include<string.h>
int TransHaab(char *NofM)
{
if(strcmp(NofM,"pop")==0)
return 1;
if(strcmp(NofM,"no")==0)
return 2;
if(strcmp(NofM," zip")==0)
return 3;
if(strcmp(NofM,"zotz")==0)
return 4;
if(strcmp(NofM,"tzec")==0)
return 5;
if(strcmp(NofM,"xul")==0)
return 6;
if(strcmp(NofM,"yoxkin")==0)
return 7;
if(strcmp(NofM,"mol")==0)
return 8;
if(strcmp(NofM,"chen")==0)
return 9;
if(strcmp(NofM,"yax")==0)
return 10;
if(strcmp(NofM,"zac")==0)
return 11;
if(strcmp(NofM,"ceh")==0)
return 12;
if(strcmp(NofM,"mac")==0)
return 13;
if(strcmp(NofM,"kankin")==0)
return 14;
if(strcmp(NofM,"muan")==0)
return 15;
if(strcmp(NofM,"pax")==0)
return 16;
if(strcmp(NofM,"koyab")==0)
return 17;
if(strcmp(NofM,"cumhu")==0)
return 18;
if(strcmp(NofM,"uayet")==0)
return 19;
}
void TransTzd(int NofD)
{
switch(NofD)
{
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 20:cout<<"ahau";break;
}
}
int daycount(int DNum,char *NofM,int Hyears)
{
long month,counts;
month=TransHaab(NofM);
counts=Hyears*365+(month-1)*20+DNum+1;
return counts;
}
void TransCalender(long dcount)
{
long years,num,mod,NofD;
years=dcount/260;
mod=dcount%260;
num=mod%13;
if(num==0)
num=13;
NofD=mod%20;
if(NofD==0)
NofD=20;
cout<<num<<' ';
TransTzd(NofD);
cout<<' '<<years<<endl;
}
int main()
{
long m,DNum,Hyears;
char temp;
static char NofM[15];
long dcount[60000];
cin>>m;
for(int i=0;i<m;i++)
{
cin>>DNum>>temp>>NofM>>Hyears;
dcount[i]=daycount(DNum,NofM,Hyears);
}
cout<<m<<endl;
for(int k=0;k<m;k++)
{
TransCalender(dcount[k]);
}
return 0;
} 展开
1个回答
展开全部
#include<iostream>
using namespace std;
#include<string.h>
int TransHaab(char *NofM)
{
if(strcmp(NofM,"pop")==0)
return 1;
if(strcmp(NofM,"no")==0)
return 2;
if(strcmp(NofM,"zip")==0) // "zip" 中间多了个空格
return 3;
if(strcmp(NofM,"zotz")==0)
return 4;
if(strcmp(NofM,"tzec")==0)
return 5;
if(strcmp(NofM,"xul")==0)
return 6;
if(strcmp(NofM,"yoxkin")==0)
return 7;
if(strcmp(NofM,"mol")==0)
return 8;
if(strcmp(NofM,"chen")==0)
return 9;
if(strcmp(NofM,"yax")==0)
return 10;
if(strcmp(NofM,"zac")==0)
return 11;
if(strcmp(NofM,"ceh")==0)
return 12;
if(strcmp(NofM,"mac")==0)
return 13;
if(strcmp(NofM,"kankin")==0)
return 14;
if(strcmp(NofM,"muan")==0)
return 15;
if(strcmp(NofM,"pax")==0)
return 16;
if(strcmp(NofM,"koyab")==0)
return 17;
if(strcmp(NofM,"cumhu")==0)
return 18;
if(strcmp(NofM,"uayet")==0)
return 19;
}
void TransTzd(int NofD)
{
switch(NofD)
{
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 20:cout<<"ahau";break;
}
}
int daycount(int DNum,char *NofM,int Hyears)
{
long month,counts;
month=TransHaab(NofM);
counts=Hyears*365+(month-1)*20+DNum+1;
return counts;
}
void TransCalender(long dcount)
{
long years,num,mod,NofD;
years=(dcount-1)/260; // 忘记-1, 这是硬伤啊
mod=dcount%260;
num=mod%13;
if(num==0)
num=13;
NofD=mod%20;
if(NofD==0)
NofD=20;
cout<<num<<' ';
TransTzd(NofD);
cout<<' '<<years<<endl;
}
int main()
{
long m,DNum,Hyears;
char temp;
static char NofM[15];
long dcount[60000];
cin>>m;
for(int i=0;i<m;i++)
{
cin>>DNum>>temp>>NofM>>Hyears;
dcount[i]=daycount(DNum,NofM,Hyears);
}
cout<<m<<endl;
for(int k=0;k<m;k++)
{
TransCalender(dcount[k]);
}
return 0;
}
using namespace std;
#include<string.h>
int TransHaab(char *NofM)
{
if(strcmp(NofM,"pop")==0)
return 1;
if(strcmp(NofM,"no")==0)
return 2;
if(strcmp(NofM,"zip")==0) // "zip" 中间多了个空格
return 3;
if(strcmp(NofM,"zotz")==0)
return 4;
if(strcmp(NofM,"tzec")==0)
return 5;
if(strcmp(NofM,"xul")==0)
return 6;
if(strcmp(NofM,"yoxkin")==0)
return 7;
if(strcmp(NofM,"mol")==0)
return 8;
if(strcmp(NofM,"chen")==0)
return 9;
if(strcmp(NofM,"yax")==0)
return 10;
if(strcmp(NofM,"zac")==0)
return 11;
if(strcmp(NofM,"ceh")==0)
return 12;
if(strcmp(NofM,"mac")==0)
return 13;
if(strcmp(NofM,"kankin")==0)
return 14;
if(strcmp(NofM,"muan")==0)
return 15;
if(strcmp(NofM,"pax")==0)
return 16;
if(strcmp(NofM,"koyab")==0)
return 17;
if(strcmp(NofM,"cumhu")==0)
return 18;
if(strcmp(NofM,"uayet")==0)
return 19;
}
void TransTzd(int NofD)
{
switch(NofD)
{
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 20:cout<<"ahau";break;
}
}
int daycount(int DNum,char *NofM,int Hyears)
{
long month,counts;
month=TransHaab(NofM);
counts=Hyears*365+(month-1)*20+DNum+1;
return counts;
}
void TransCalender(long dcount)
{
long years,num,mod,NofD;
years=(dcount-1)/260; // 忘记-1, 这是硬伤啊
mod=dcount%260;
num=mod%13;
if(num==0)
num=13;
NofD=mod%20;
if(NofD==0)
NofD=20;
cout<<num<<' ';
TransTzd(NofD);
cout<<' '<<years<<endl;
}
int main()
{
long m,DNum,Hyears;
char temp;
static char NofM[15];
long dcount[60000];
cin>>m;
for(int i=0;i<m;i++)
{
cin>>DNum>>temp>>NofM>>Hyears;
dcount[i]=daycount(DNum,NofM,Hyears);
}
cout<<m<<endl;
for(int k=0;k<m;k++)
{
TransCalender(dcount[k]);
}
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询