Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

老是PE,到底是哪儿的问题?

Posted by zhangyongyue at 2013-11-11 23:17:07 on Problem 1008
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main() {
    int ncases,year,days;
    string day,month;
    int tday[10000];
    string tmonth[10000];
    int tyear[10000]; 
    string haab[19] = {"pop","no","zip","zotz","tzec","xul","yoxkin","mol","chen","yax","zac","ceh","mac","kankin","muan","pax","koyab","cumhu","uayet"};
    string tzolkin[20] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat"," muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau"};
    cin>>ncases;
    for(int i = 0; i < ncases; i++) {
        cin>>day>>month>>year;
        string daystr = "";
        for(int l = 0; l < day.size()-1; l++) {
            daystr += day[l]; 
        }
        stringstream ss;
        int dayint = 0;
        ss<<daystr;
        ss>>dayint;
        for(int k = 0; k < 19; k++) {
            if(month == haab[k]) {
                days =  year*365 + k * 20 + dayint;
                break;
            }
        }
        tyear[i] = days/260;
        int tmod = days%260;
        tmonth[i] = tzolkin[tmod%20];
        tday[i] = tmod%13 + 1;
        
    }
    cout<<ncases<<endl;
    for(int i = 0; i < ncases; i++) {
        cout<<tday[i]<<" "<<tmonth[i]<<" "<<tyear[i]<<endl;
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator