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 |
大佬看看为啥一直Runtime error,感觉没啥问题,改了好几个版本#include<string> #include<stdio.h> #include<stdlib.h> #include <iostream> using namespace std; int sl3; string sl1; string sl2; int Haab(string s2) { if (s2 == "pop") return 0;else if (s2 == "no") return 1 * 20;else if (s2 == "zip") return 2 * 20;else if (s2 == "zotz") return 3 * 20;else if (s2 == "tzec") return 4 * 20;else if (s2 == "xul") return 5 * 20;else if (s2 == "yoxkin") return 6 * 20;else if (s2 == "mol") return 7 * 20;else if (s2 == "chen") return 8 * 20;else if (s2 == "yax") return 9 * 20;else if (s2 == "zac") return 10 * 20;else if (s2 == "ceh") return 11 * 20;else if (s2 == "mac") return 12 * 20;else if (s2 == "kankin") return 13 * 20;else if (s2 == "muan") return 14 * 20;else if (s2 == "pax") return 15 * 20;else if (s2 == "koyab") return 16 * 20;else if (s2 == "cumhu") return 17 * 20;else return 18 * 20; } string Tzolkin(int day) { switch (day) { case 1:return "imix";case 2:return "ik"; case 3:return "akbal";case 4:return "kan"; case 5:return "chicchan";case 6:return "cimi"; case 7:return "manik";case 8:return "lamat"; case 9:return "muluk";case 10:return "ok"; case 11:return "chuen";case 12:return "eb"; case 14:return "ix";case 15:return "mem"; case 16:return "cib";case 17:return "caban"; case 18:return "eznab";case 19:return "canac"; case 0:return "ahau";default: break; } } void map(int date) { int day, number, year; string Day; int a = date % 260; if (a == 0) { year = date / 260 - 1; number = (date - year * 260) % 13; if (number == 0) number = 13; day = (date - year * 260) % 20; Day = Tzolkin(day); } else { year = date / 260; number = (date - year * 260) % 13; day = (date - year * 260) % 20; Day = Tzolkin(day); } cout << number << " " << Day << " " << year << endl; } void Hash() { int day = 0, k; day = atoi(sl1.c_str())+1; k = Haab(sl2); day += k + sl3 * 365; map(day); } int main() { int n; cin >> n; cout << n << endl; for (int i = 0; i < n; i++) { cin >> sl1 >> sl2 >> sl3; Hash(); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator