简单题。

#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. redis高级实用特性(1)

    1.安全性 2.主从复制 3.事务处理 4.持久化机制 5.发布订阅消息 6.虚拟内存的使用 安全性:设置客户端连接后进行任何其他指定前需要使用的密码 警告:因为redis速度相当快,所以在一台比较好 ...

  2. 微信web开发工具

    http://mp.weixin.qq.com/wiki/10/e5f772f4521da17fa0d7304f68b97d7e.html#.E4.B8.8B.E8.BD.BD.E5.9C.B0.E5 ...

  3. over 分析函数之 lag() lead()

    /*语法*/ lag(exp_str,offset,defval) over()  取前 Lead(exp_str,offset,defval) over()  取后 --exp_str要取的列 -- ...

  4. FZU 1502 Letter Deletion

    最长公共子序列. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #i ...

  5. 巧用weui.topTips验证数据

    场景一.有一个输入金额的场景,这个金额需要验证,验证说明如下: 不能为空格: 不能为0: 不能为汉字: 不能为其它字符: 不能大于200: 唯一可以的是,只有输入3~199之间的数字,下面的确定按钮才 ...

  6. PostMessage 向Windows窗口发送Alt组合键

    PostMessage 向Windows窗口发送Alt组合键 关于向Windows窗口发送Alt组合键的问题,这个真是经典问题啊,在网上找了一下,问的人N多,方法差不多, 但就是没有很好解决问题. 之 ...

  7. 用sqlyog远程连接LINUX系统的MYSQL出现错解决方法

    无法给远程连接的用户权限问题.结果这样子操作mysql库,即可解决.在本机登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称'%' ...

  8. URLEncode和URLDecoder作用

    一.基本原理 对于URL传递到后台,会对其中的有些字符进行编码,以下是我百度到的一些资料. 网页中的表单使用POST方法提交时,数据内容的类型是 application/x-www-form-urle ...

  9. ldap基本命令

    前端数据如下: ### frontend.ldif ### dn: dc=ldap,dc=example,dc=com objectclass: top objectclass: dcObject o ...

  10. 让AutoMapper在你的项目里飞一会儿(转)

    出处:http://www.cnblogs.com/WeiGe/p/3835523.html 先说说DTO DTO是个什么东东? DTO(Data Transfer Object)就是数据传输对象,说 ...