简单题。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std; char a[][]={
"tret","jan", "feb", "mar", "apr", "may", "jun", "jly", "aug", "sep", "oct", "nov", "dec"
}; char b[][]={
"zzz","tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mer", "jou"
}; int main()
{
int n; char s[];
scanf("%d",&n); getchar();
for(int i=;i<=n;i++)
{
gets(s);
if(s[]>=''&&s[]<='')
{
int num=;
for(int i=;s[i];i++) num=num*+s[i]-'';
if(num<=) printf("%s\n",a[num]);
else if(num%==) printf("%s\n",b[num/]);
else printf("%s %s\n",b[num/],a[num%]);
}
else
{
int p=-;
for(int i=;s[i];i++) if(s[i]==' ') p=i;
if(p==-)
{
int num=;
for(int i=;i<=;i++)
if(strcmp(a[i],s)==) num=i;
for(int i=;i<=;i++)
if(strcmp(b[i],s)==) num=*i;
printf("%d\n",num);
}
else
{
int num=;
char op[]; int sz=;
for(int i=;i<p;i++) op[sz++]=s[i]; op[sz]=;
for(int i=;i<=;i++)
if(strcmp(b[i],op)==) num=*i;
sz=;
for(int i=p+;s[i];i++) op[sz++]=s[i]; op[sz]=;
for(int i=;i<=;i++)
if(strcmp(a[i],op)==) num+=i;
printf("%d\n",num);
}
}
}
return ;
}

PAT (Advanced Level) 1100. Mars Numbers (20)的更多相关文章

  1. PAT甲级题解-1100. Mars Numbers (20)-字符串处理

    没什么好说的,注意字符串的处理,以及当数字是13的倍数时,只需高位叫法的单词.比如26,是“hel”,而不是“hel tret”. 代码: #include <iostream> #inc ...

  2. 【PAT甲级】1100 Mars Numbers (20 分)

    题意: 输入一个正整数N(<100),接着输入N组数据每组包括一行字符串,将其翻译为另一个星球的数字. AAAAAccepted code: #define HAVE_STRUCT_TIMESP ...

  3. PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1008 Elevator (20 分) 凌宸1642 题目描述: The highest building in our city has ...

  4. PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...

  5. 1100. Mars Numbers (20)

    People on Mars count their numbers with base 13: Zero on Earth is called "tret" on Mars. T ...

  6. PAT (Advanced Level) 1108. Finding Average (20)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  7. PAT (Advanced Level) Practice 1035 Password (20 分)

    To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...

  8. PAT (Advanced Level) Practice 1008 Elevator (20 分) (模拟)

    The highest building in our city has only one elevator. A request list is made up with N positive nu ...

  9. 【PAT Advanced Level】1008. Elevator (20)

    没什么难的,简单模拟题 #include <iostream> using namespace std; int main() { int num; cin>>num; int ...

随机推荐

  1. hosts文件失效,配置的域名不能成功访问

    在windows7系统 hosts文件中配置域名 出现hosts文件失效  并不能正常访问域名 可能并不适用所有的这样的情况  但是我自己修改了dns的服务器的状态  就可以正常访问 如下图所示

  2. hadoop性能测试命令

    1.测试hadoop写的速度向HDFS文件系统中写入数据,10个文件,每个文件10MB,文件存放到/benchmarks/TestDFSIO/io_data中hadoop  jar share/had ...

  3. 查询mysql中经纬度判断坐标范围

    先上代码,稍后附上说明: 1. 从mysql中取出记录,打印有效经纬度: import json import MySQLdb # lines = c.fetchall() #所有的记录,一个tupl ...

  4. 五种JSP页面跳转方法详解

    1. RequestDispatcher.forward() 是在服务器端起作用,当使用forward()时,Servlet engine传递HTTP请求从当前的Servlet or JSP到另外一个 ...

  5. 【转载】将绿色版Tomcat服务添加到系统服务并设为开机运行

    转自: http://www.cnblogs.com/lan0725/archive/2009/11/04/1873859.html   运行cmd打开控制台,进入Tomat目录/bin文件夹,输入如 ...

  6. CentOS7 PostgreSQL 主从配置( 三)

    postgres 主备切换 主备查看 方法 ps -ef | grep wal (主库 sender)postgres 27873 27864 0 5月06 ? 00:00:10 postgres: ...

  7. 使用shell脚本自定义实现选择登录ssh

    在系统bin目录中建立两个脚本分别是pssh tssh pssh #!/usr/bin/expect -f set ip [lindex ] set port [lindex ] set passwo ...

  8. bind启动时提示953端口被使用

    部署DNS的时候遇到个奇葩的问题,总是提示 couldn't add command channel 0.0.0.0#953: address in use 实际上系统上并没有进程使用953端口.查询 ...

  9. docker容器和镜像区别

    这篇文章希望能够帮助读者深入理解Docker的命令,还有容器(container)和镜像(image)之间的区别,并深入探讨容器和运行中的容器之间的区别. 当我对Docker技术还是一知半解的时候,我 ...

  10. CSS Day04 css核心基础

    1.在HTML中引入CSS的方法 (1)行内式 行内式即在标记的style属性中设定CSS样式,这种方式本质上没有体现出CSS的优势,因此不推荐使用.  例如:  <h1 style=“colo ...