POJ 1008.Maya Calendar

题目:http://poj.org/problem?id=1008

AC代码(C++):

#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>

using namespace std;

int main(){
	int n;
	int* m;
	cin>>n;
	m = new int[n];
	for(int i = 0; i < n; i++){
		int dd;
		int mm;
		int yy;
		char str[10];
		scanf("%d. %s %d",&dd,&str,&yy);
		string strs = str;
		if(strs.compare("pop")==0){
			mm = 0;
		}
		else if(strs.compare("no")==0){
			mm = 1;
		}
		else if(strs.compare("zip")==0){
			mm = 2;
		}
		else if(strs.compare("zotz")==0){
			mm = 3;
		}
		else if(strs.compare("tzec")==0){
			mm = 4;
		}
		else if(strs.compare("xul")==0){
			mm = 5;
		}
		else if(strs.compare("yoxkin")==0){
			mm = 6;
		}
		else if(strs.compare("mol")==0){
			mm = 7;
		}
		else if(strs.compare("chen")==0){
			mm = 8;
		}
		else if(strs.compare("yax")==0){
			mm = 9;
		}
		else if(strs.compare("zac")==0){
			mm = 10;
		}
		else if(strs.compare("ceh")==0){
			mm = 11;
		}
		else if(strs.compare("mac")==0){
			mm = 12;
		}
		else if(strs.compare("kankin")==0){
			mm = 13;
		}
		else if(strs.compare("muan")==0){
			mm = 14;
		}
		else if(strs.compare("pax")==0){
			mm = 15;
		}
		else if(strs.compare("koyab")==0){
			mm = 16;
		}
		else if(strs.compare("cumhu")==0){
			mm = 17;
		}
		else if(strs.compare("uayet")==0){
			mm = 18;
		}
		m[i] = yy*365 + mm*20 + dd;
	}
	
	cout<<n<<endl;
	
	for(int i = 0; i < n; i++){
		cout<<m[i]%13+1<<" ";
		if(m[i]%20+1==1){
			cout<<"imix ";
		}
		else if(m[i]%20+1==2){
			cout<<"ik ";
		}
		else if(m[i]%20+1==3){
			cout<<"akbal ";
		}
		else if(m[i]%20+1==4){
			cout<<"kan ";
		}
		else if(m[i]%20+1==5){
			cout<<"chicchan ";
		}
		else if(m[i]%20+1==6){
			cout<<"cimi ";
		}
		else if(m[i]%20+1==7){
			cout<<"manik ";
		}
		else if(m[i]%20+1==8){
			cout<<"lamat ";
		}
		else if(m[i]%20+1==9){
			cout<<"muluk ";
		}
		else if(m[i]%20+1==10){
			cout<<"ok ";
		}
		else if(m[i]%20+1==11){
			cout<<"chuen ";
		}
		else if(m[i]%20+1==12){
			cout<<"eb ";
		}
		else if(m[i]%20+1==13){
			cout<<"ben ";
		}
		else if(m[i]%20+1==14){
			cout<<"ix ";
		}
		else if(m[i]%20+1==15){
			cout<<"mem ";
		}
		else if(m[i]%20+1==16){
			cout<<"cib ";
		}
		else if(m[i]%20+1==17){
			cout<<"caban ";
		}
		else if(m[i]%20+1==18){
			cout<<"eznab ";
		}
		else if(m[i]%20+1==19){
			cout<<"canac ";
		}
		else if(m[i]%20+1==20){
			cout<<"ahau ";
		}
		cout<<m[i]/260<<endl;
	}
}
总结:水题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值