Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
让玛雅历算出来的day从0开始就好了#include <iostream> #include <stdio.h> #include <string.h> using namespace std; char myM[19][10] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu","uayet"}; char hoW[20][10] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; int getMyM(char* m) { for (int i=0; i<19; i++){ if(strcmp(myM[i], m) == 0){ return i; } } } int main() { int testCase; int myDay, myYear, hoDay, hoMon, hoYear, day; char myMonth[10]; scanf("%d", &testCase); printf("%d\n", testCase); while(testCase--) { scanf("%d. %s %d", &myDay, myMonth, &myYear); day = 365 * myYear + myDay + 20 * getMyM(myMonth); hoDay = 1 + day%13; hoMon = day%20; hoYear = day/260; printf("%d %s %d\n", hoDay, hoW[hoMon], hoYear); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator