POJ1008

地址:http://poj.org/problem?id=1008

一开始不知道自己为啥一直Runtime Error,后面发现自己眼睛瞎了,少写一种情况…

#include "pch.h"
#include<string>
#include <iostream>
using namespace std;
int sl3;
string sl1;
string sl2;
int Haab(string s2)
{
 if (s2 == "pop")
  return 0;else if (s2 == "no")
  return 1 * 20;else if (s2 == "zip")
  return 2 * 20;else if (s2 == "zotz")
  return 3 * 20;else if (s2 == "tzec")
  return 4 * 20;else if (s2 == "xul")
  return 5 * 20;else if (s2 == "yoxkin")
  return 6 * 20;else if (s2 == "mol")
  return 7 * 20;else if (s2 == "chen")
  return 8 * 20;else if (s2 == "yax")
  return 9 * 20;else if (s2 == "zac")
  return 10 * 20;else if (s2 == "ceh")
  return 11 * 20;else if (s2 == "mac")
  return 12 * 20;else if (s2 == "kankin")
  return 13 * 20;else if (s2 == "muan")
  return 14 * 20;else if (s2 == "pax")
  return 15 * 20;else if (s2 == "koyab")
  return 16 * 20;else if (s2 == "cumhu")
  return 17 * 20;else
  return 18 * 20;
}
string Tzolkin(int day)
{
 switch (day)
 {
 case 1:return "imix";case 2:return "ik";
 case 3:return "akbal";case 4:return "kan";
 case 5:return "chicchan";case 6:return "cimi";
 case 7:return "manik";case 8:return "lamat";
 case 9:return "muluk";case 10:return "ok";
 case 11:return "chuen";case 12:return "eb";
 case 14:return "ix";case 15:return "mem";
 case 16:return "cib";case 17:return "caban";
 case 18:return "eznab";case 19:return "canac";
 case 20:return "ahau";case 13:return "ben";
  }
}
void map(int date)
{
 int day, number, year;
 string Day;
  year = date / 260;
  number = (date - year * 260) % 13+1;
  day = (date - year * 260) % 20+1;
  Day = Tzolkin(day);
 cout << number << " " << Day << " " << year << endl;
}
void Hash()
{
 int day = 0, k;
 day = atoi(sl1.c_str());
 k = Haab(sl2);
 day += k + sl3 * 365;
 map(day);
}
int main()
{
 int n; cin >> n;
 cout << n << endl;
 for (int i = 0; i < n; i++)
 {
  cin >> sl1 >> sl2 >> sl3;
  Hash();
 }
 return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值