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 |
为什么我得到的老是Wrong Answer,哪位大神帮我看看吧,非常感谢啊#include<iostream> #include<string> #include<map> using namespace std; int main() { int n = 0;; float day = 0.0; string month; int dwMonth = 0; int year = 0; int totalDay = 0; cin >> n; cout << n; string strHaab[] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"}; map<string,int> mapHaab; for(int i = 0;i < 19;i++) { mapHaab.insert(map<string, int>::value_type(strHaab[i],i)); } string strTzolkin[] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"}; while(n--) { cin >> day >> month >> year; map<string,int>::iterator ite = mapHaab.find(month); if(ite != mapHaab.end()) { dwMonth = mapHaab[month]; } totalDay = (int)day + 1 + 20 * dwMonth + year * 365; year = totalDay / 260; if(totalDay % 260 == 0) { year = year - 1; day = 13; month = "ahau"; } else { day = (totalDay % 260) % 13; dwMonth = (totalDay % 260) % 20; month = strTzolkin[dwMonth-1]; } cout << day << " " << month << " " << year; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator