//
// main.cpp
// PATA1100
//
// Created by Phoenix on 2018/2/22.
// Copyright © 2018年 Phoenix. All rights reserved.
//
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <string>
using namespace std;
string month[13] = {"tret", "tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mer", "jou"};
string day[13] = {"tret", "jan", "feb", "mar", "apr", "may", "jun", "jly", "aug", "sep", "oct", "nov", "dec"};
map<string, int> mp1;
map<string, int> mp2;
void init() {
for(int i = 0; i < 13; i++) {
mp1[month[i]] = i;
}
for(int i = 0; i < 13; i++) {
mp2[day[i]] = i;
}
}
int main(int argc, const char * argv[]) {
init();
int n;
scanf("%d ", &n);
for(int i = 0; i < n; i++) {
char str[10];
gets(str);
if(str[0] >= '0' && str[0] <= '9') {
int num = 0;
for(int j = 0; j < strlen(str); j++) {
num = num * 10 + str[j] - '0';
}
if(num % 13 == 0) {
cout << month[num / 13] << endl;
}else {
if(num / 13 == 0) cout << day[num] << endl;
else cout << month[num / 13] << " " << day[num % 13] << endl;
}
} else if(strlen(str) > 4) {
string a, b;
int j = 0;
while(str[j] != ' ') {
a += str[j];
j++;
}
j++;
while(str[j] >= 'a' && str[j] <= 'z' && j < strlen(str)){
b += str[j];
j++;
}
//cout << mp1[a];
int ans = mp1[a] * 13 + mp2[b];
//cout << a << " " << b << " ";
printf("%d\n", ans);
} else {
string a;
int j = 0;
while(str[j] >= 'a' && str[j] <= 'z' && j < strlen(str)) {
a += str[j];
j++;
}
printf("%d\n", mp1[a] * 13 + mp2[a]);
}
}
return 0;
}
PATA1100题解
最新推荐文章于 2020-11-24 20:11:17 发布