题目大意:日历1有365天,分别为18个月(每个月有个名字)*20天(0---19)+1个月*5天(0---4),日历2有13个月,每个月20天(每天有个名字),要求将日历1转换为日历2,输入格式为日,月,年,输出格式为月,日,年
解题思路:根据日历1算出总天数,再用mod求对应的,在比较月份的时候用了一个while();的形式,表示直到括号中的表达式为假跳出循环,再继续执行while后面的语句,此语句能够找出月历1的当前的月份
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <list>
#include <set>
char month_Haab[19][20]={"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
char name_day_Tzolkin[20][20]={"imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"};
int day_h,year_h;
char month_h[20];
int day_t,year_t,month_t;
int main()
{
int t;
scanf("%d",&t);
printf("%d\n",t);
while(t--)
{
scanf("%d. %s %d",&day_h,month_h,&year_h);
int tmp_month=0;
while(strcmp(month_h,month_Haab[tmp_month++])!=0);
long tmp_day=year_h*365+day_h+1+(tmp_month-1)*20;
printf("%d %s %d\n",(tmp_day-1)%13+1,name_day_Tzolkin[(tmp_day-1)%20],(tmp_day-1)/260);
}
return 0;
}