1100 Mars Numbers [模拟]

Posted fta-macro

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1100 Mars Numbers [模拟]相关的知识,希望对你有一定的参考价值。

技术图片
#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 [模拟]的主要内容,如果未能解决你的问题,请参考以下文章

1100. Mars Numbers (20)

1100 Mars Numbers

1100 Mars Numbers (20 分)

PAT1100:Mars Numbers

PAT 1100 Mars Numbers

1100 Mars Numbers (20分)