标签:
模拟,先算出天数,再转化成另一个历。
#include<iostream> #include<cstdio> #include<cstring> using namespace std; char name[21][10] = {"0","imix","ik","akbal","kan","chicchan","cimi","manik","lamat","muluk","ok","chuen","eb","ben","ix","mem","cib","caban","eznab","canac","ahau"}; int getmonth(char *a) { int ASCII = 0,l = strlen(a); for (int i=0;i<l;i++) ASCII += a[i]; switch(ASCII) { case 335:return 1; case 221:return 2; case 339:return 3; case 471:return 4; case 438:return 5; case 345:return 6; case 674:return 7; case 328:return 8; case 414:return 9; case 338:return 10; case 318:return 11; case 304:return 12; case 305:return 13; case 636:return 14; case 433:return 15; case 329:return 16; case 534:return 17; case 546:return 18; case 552:return 19; } } int getday(int day,int month,int year) { int sumday = 0; for (int i=0;i<year;i++) sumday += 365; for (int i=1;i<month;i++) sumday += 20; return sumday+day; } int main() { int T,day,year,sumday = 0; char month[10]; char doc; cin>>T; cout<<T<<endl; while (T--) { cin>>day>>doc>>month>>year; sumday = getday(day,getmonth(month),year); cout<<sumday%13+1<<‘ ‘<<name[sumday%20+1]<<‘ ‘<<sumday/260<<endl; } }
标签:
原文地址:http://www.cnblogs.com/liumengyue/p/5598848.html