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 |
Re:数据都没问题!!为什么还是没法让我睡呢??各位,救救我吧In Reply To:Re:数据都没问题!!为什么还是没法让我睡呢??各位,救救我吧 Posted by:sehdan at 2009-01-02 13:00:04 // poj1008.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> #include<vector> #include<string> #include<map> using namespace std; #define zyear 260 #define hyear 365 typedef struct { int date ; string mon ; int year ; } haab ; typedef struct { int day ; string name ; int year ; } zol ; string hmon[19] = {"pop", "no", "zip", "zotz", "tzec", "xul", "yoxkin", "mol", "chen", "yax", "zac", "ceh", "mac", "kankin", "muan", "pax", "koyab", "cumhu" , "uayet"}; string zmon[20] = {"imix", "ik", "akbal", "kan", "chicchan", "cimi", "manik", "lamat", "muluk", "ok", "chuen", "eb", "ben", "ix", "mem", "cib", "caban", "eznab", "canac", "ahau" }; void tran ( haab & lhs , zol & rhs ) { int tp = 1 ; while ( strcmp ( lhs.mon.c_str () , hmon[tp-1].c_str() ) != 0 ) { ++tp ; } rhs.year =( lhs.year * hyear + tp * 20 + lhs.date ) / zyear ; rhs.day = ( lhs.year * hyear + tp * 20 + lhs.date ) % 13 + 1 ; rhs.name = zmon [ ( lhs.year * hyear + tp * 20 + lhs.date ) % 20 ] ; } int _tmain(int argc, _TCHAR* argv[]) { vector<haab> sto ; haab temp; zol rhs ; string laji; int n ; cin >> n; for ( int i = 0 ; i < n ; ++ i ) { cin >> temp.date >> laji >> temp.mon >> temp.year ; sto.push_back(temp); } cout << n << endl; for ( int i = 0 ; i < n ; ++ i ) { tran(sto[i] , rhs ); cout << rhs.day << " " << rhs.name << " " << rhs.year << 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