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 |
真无语,我实在看不出来哪里错了。#include <iostream> #include <string> using namespace std; int main() { string haab_month[19] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu", "uayet"}; string tzolkin_2[20] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" }; int data_count; cin >> data_count; string s_day; string s_month; int day; int month; int year; long sum; int out_1[100]; string out_2[100]; int out_year[100]; int i = 0; int j = 0; while(data_count) { data_count--; cin >> s_day >> s_month >> year; s_day.resize(s_day.size() - 1); day = atoi(s_day.c_str()); for(int k = 0; k < 19; k++) { if(haab_month[k] == s_month) { month = k; break; } } sum = day + month * 20 + year * 365; out_1[i] = (sum % 260) % 13 + 1; out_2[i] = tzolkin_2[(sum % 260) % 20]; out_year[i] = sum / 260; i++; } cout << i << endl; for(j = 0; j < i; j++) { cout << out_1[j] << " " << out_2[j] << " " << out_year[j] << endl; } return 0; } 试了好多数据都对,那位肯帮帮忙么。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator