【网络】UDP 报文头部

时间:2025-03-04 18:07:48
【全网最细PAT题解】【PAT乙】1044 火星数字(测试点2,测试点4详细解释)

kurisutina520: 自己的[code=cpp] #include<bits/stdc++.h> using namespace std; string Mars_num1[13] = {"tret","jan","feb","mar","apr","may","jun","jly","aug","sep","oct","nov","dec"}; string Mars_num2[13] = {"","tam","hel","maa","huh","tou","kes","hei","elo","syy","lok","mer","jou"}; int main(){ int n;cin>>n; string s; int p=n; while(p--){ cin>>s; if(s[0]<='9'&&s[0]>='0'){ int x=stoi(s); int h=x/13; int l=x%13; if(h!=0){ cout<<Mars_num2[h]; if(l!=0){ cout<<" "; cout<<Mars_num1[l]; } } else cout<<Mars_num1[l]; } else { int ans=0; for(int i=0;i<13;i++)if(Mars_num2[i]==s)ans+=(i*13); char ch=getchar(); if(ch==' ') cin>>s; for(int i=0;i<13;i++)if(Mars_num1[i]==s)ans+=i; cout<<ans; } cout<<"\n"; } } [/code]