简单题。

#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. MVC view视图获取Html.RenderAction方式带来的参数

    通过Html.RenderAction这种方式传递的参数,在view视图中获取要使用viewContext上下文来获取:Html.ViewContext.RouteData.Values[" ...

  2. 安装appuim

    一.作为一名软件测试人员,对工作习惯和品质的有要求,要有对问题的敏感度,遇到问题就不能轻易放过,提前保存一切可能对分析解决问题有帮助的资料,不怕麻烦,尽可能的全面详细,不漏重点.若神经大条,嫌麻烦,不 ...

  3. jsp之用户自定义标签

    创建一个类,引入外部jsp-api.jar包(在tomcat 下lib包里有),这个类继承SimpleTagSupport 重写doTag()方法. jspprojec包下的helloTag类: pu ...

  4. JavaScript高级程序设计:第三章

    基本概念 一.语法: 1.区分大小写: 2.标识符:指变量.函数.属性的名字,或者函数的参数.标识符可以是按照下列格式规则组合起来的一个或多个字符: (1)第一个字符必须是一个字母.下划线(_).或者 ...

  5. IoC容器Autofac正篇之类型关联(服务暴露)(八)

    类型关联  类型关联就是将类挂载到接口(一个或多个)上去,以方便外部以统一的方式进行调用(看下例). 一.As关联 我们在进行手动关联时,基本都是使用As进行关联的. 1 2 3 4 5 6 7 8 ...

  6. ios 中NSArray

    // #import <Foundation/Foundation.h> #import "Animal.h" int main(int argc, const cha ...

  7. php数据排序---array_multisort

    PHP代码 <?php $ar1 = array(10, 100, 100, 0); $ar2 = array(1, 3, 2, 4); array_multisort($ar1, $ar2); ...

  8. 学习PHP函数:preg_match_all

    <?php $str = '10.10.10.10, 10.10.10.11'; preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', ...

  9. SQL 列拆分

    with CTE as( SELECT A.id, B.value FROM( SELECT id, value = CONVERT(xml,'<root><v>' + REP ...

  10. nginx优化缓冲缓存

    反向代理的一个问题是代理大量用户时会增加服务器进程的性能冲击影响.在大多数情况下,可以很大程度上能通过利用Nginx的缓冲和缓存功能减轻. 当代理到另一台服务器,两个不同的连接速度会影响客户的体验: ...