码迷,mamicode.com
首页 > 其他好文 > 详细

1100 Mars Numbers [模拟]

时间:2019-08-31 21:29:03      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:++   git   pen   def   cli   using   ring   lse   --   

技术图片
#include <bits/stdc++.h>
using namespace std;
#define maxn 55

string fir[]={"tret","jan","feb","mar","apr","may","jun","jly","aug","sep","oct","nov","dec"};
string sec[]={"#","tam","hel","maa","huh","tou","kes","hei","elo","syy","lok","mer","jou"};
map<string,int> m1,m2;
int main()
{
    string s;
    int n;
    cin>>n;
    for(int i=0;i<=12;i++){
        m1[fir[i]]=i;
        m2[sec[i]]=i;
    }
    getchar();
    while(n--)
    {
        getline(cin,s);
        if(isdigit(s[0]))
        {
            int tmp=0;
            for(int i=0;i<s.length();i++)
                tmp=tmp*10+s[i]-0;
            if(tmp<=12)
                cout<<fir[tmp];
            else
            {
                int t1=tmp/13;
                int t2=tmp%13;
                cout<<sec[t1];
                if(t2)
                    cout<<" "<<fir[t2];
            }
        }
        else
        {
            if(s.length()==3)
            {
                if(m1.count(s)==1)
                    cout<<m1[s];
                else
                    cout<<m2[s]*13;
            }
            else
            {
                string s1,s2;
                s1=s.substr(0,3);
                s2=s.substr(4,3);
                cout<<m2[s1]*13+m1[s2];
            }
        }
        cout<<endl;
    }
}
View Code

 

1100 Mars Numbers [模拟]

标签:++   git   pen   def   cli   using   ring   lse   --   

原文地址:https://www.cnblogs.com/FTA-Macro/p/11440296.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!