北大oj上的一道题,哪位高手有兴趣解答下,感激不尽 http://poj.org/problem?id=1008

 我来答
porker2008
2012-07-04 · TA获得超过1.4万个赞
知道大有可为答主
回答量:7066
采纳率:62%
帮助的人:1.1亿
展开全部
#include <iostream>
#include <string>
using namespace std;

int main()
{
int n,i,d,y,t,num,j;
char x;
char m[10];
char a[19][8]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen", "yax", "zac",
"ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char b[20][20]={"imix", "ik","akbal", "kan","chicchan","cimi","manik","lamat","muluk",
"ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
cin >> n;
cout << n << endl;
while(n--)
{
cin>>d>>x>>m>>y;
for(i=0;i<19;i++)
if(strcmp(m,a[i])==0)
{
num=y*365+i*20+d+1;
break;
}
y=num/260;
t=num%260;
if(t==0) y--;
d=t%13;
if(d==0) d = 13;
j=t%20;
if(j==0) j = 20;
strcpy(m,b[j-1]);
cout<<d<<' '<<m<<' '<<y<<endl;
}
return 0;
}
Mr_tan111
2012-07-04
知道答主
回答量:24
采纳率:0%
帮助的人:11.7万
展开全部
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式