hdoj 2816 I Love You Too
I Love You Too
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1756 Accepted Submission(s):
1056
love to a girl,but the girl didn't replied clearly ,just gave him a Morse
Code:
****-/*----/----*/****-/****-/*----/---**/*----/****-/*----/-****/***--/****-/*----/----*/**---/-****/**---/**---/***--/--***/****-/
He was so anxious that he asked for help in the Internet and after one day a
girl named "Pianyi angel" found the secret of this code. She translate this code
as this five steps:
1.First translate the morse code to a number
string:4194418141634192622374
2.Second she cut two number as one group
41 94 41 81 41 63 41 92 62 23 74,according to standard Mobile phone can
get this alphabet:GZGTGOGXNCS

3.Third she change
this alphabet according to the keyboard:QWERTYUIOPASDFGHJKLZXCVBNM =
ABCDEFGHIJKLMNOPQRSTUVWXYZ
So ,we can get OTOEOIOUYVL
4.Fourth,
divide this alphabet to two parts: OTOEOI and OUYVL, compose
again.we will get OOTUOYEVOLI
5.Finally,reverse this alphabet the
answer will appear : I LOVE YOU TOO

I guess you might
worship Pianyi angel as me,so let's Orz her.
Now,the task is translate the
number strings.
all input are legal.
#include<stdio.h>
#include<string.h>
#define MAX 1100
char s[MAX];
int a[30];
char str2[MAX];
char str5[MAX];
char str3[30]={"QWERTYUIOPASDFGHJKLZXCVBNM"};
char str4[30]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
char str1[20][5]={"\0","\0","ABC","DEF","GHI","JKL","MNO","PQRS","TUV","WXYZ"};
char str6[MAX],str7[MAX];
int main()
{
int n,m,j,i,t,l1,l2,l3,l4;
while(scanf("%s",s)!=EOF)
{
memset(a,0,sizeof(a));
memset(str2,'\0',sizeof(str2));
memset(str5,'\0',sizeof(str5));
memset(str6,'\0',sizeof(str6));
memset(str7,'\0',sizeof(str7));
l1=strlen(s);
j=0;
for(i=0;i<l1;i=i+2,j++)
str2[j]=str1[s[i]-'0'][s[i+1]-'1'];
l2=strlen(str2);
for(i=0;i<l2;i++)
for(j=0;j<26;j++)
{
if(str2[i]==str3[j])
{
a[i]=j;
break;
}
}
for(i=0;i<l2;i++)
str5[i]=str4[a[i]];
int k=l2/2;
j=0;
if(l2&1)
{
for(i=l2-1;i>k;i--)
str6[j++]=str5[i];
j=0;
for(i=k;i>=0;i--)
str7[j++]=str5[i];
}
else
{
for(i=l2-1;i>=k;i--)
str6[j++]=str5[i];
j=0;
for(i=k-1;i>=0;i--)
str7[j++]=str5[i];
}
if(l2&1)
for(i=0;i<=k;i++)
{
printf("%c",str7[i]);
if(i==k)
break;
printf("%c",str6[i]);
}
else
for(i=0;i<k;i++)
{
printf("%c",str6[i]);
printf("%c",str7[i]);
}
printf("\n");
}
return 0;
}
hdoj 2816 I Love You Too的更多相关文章
- 杭电hdoj题目分类
HDOJ 题目分类 //分类不是绝对的 //"*" 表示好题,需要多次回味 //"?"表示结论是正确的,但还停留在模块阶 段,需要理解,证明. //简单题看到就 ...
- HDOJ 题目分类
HDOJ 题目分类 /* * 一:简单题 */ 1000: 入门用:1001: 用高斯求和公式要防溢出1004:1012:1013: 对9取余好了1017:1021:1027: ...
- HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- HDOJ 1326. Box of Bricks 纯水题
Box of Bricks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
- HDOJ 1004 Let the Balloon Rise
Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...
- hdoj 1385Minimum Transport Cost
卧槽....最近刷的cf上有最短路,本来想拿这题复习一下.... 题意就是在输出最短路的情况下,经过每个节点会增加税收,另外要字典序输出,注意a到b和b到a的权值不同 然后就是处理字典序的问题,当松弛 ...
- HDOJ(2056)&HDOJ(1086)
Rectangles HDOJ(2056) http://acm.hdu.edu.cn/showproblem.php?pid=2056 题目描述:给2条线段,分别构成2个矩形,求2个矩形相交面 ...
- 继续node爬虫 — 百行代码自制自动AC机器人日解千题攻占HDOJ
前言 不说话,先猛戳 Ranklist 看我排名. 这是用 node 自动刷题大概半天的 "战绩",本文就来为大家简单讲解下如何用 node 做一个 "自动AC机&quo ...
随机推荐
- wcf通道Channel
正文 客户端与服务进行交互的过程是通过通道进行交互的.客户端通过调用代理类执行相应的方法,通过通道编码,调用上下文,传输客户端的事务,管理可靠会话,对消息正文的加密,最后要执行的通道是传输通道就像我们 ...
- Eyeshot Ultimate 学习笔记(2)
导入模型 一般情况下,我们自己搭建模型的功力还不够,大多都是在3Dmax中做好模型,导出成模型文件,然后再导入Eyeshot视图中.导入的代码包括: OpenFileDialog openFileDi ...
- node 无解回调 有解了
http://cssor.com/javascript-workflow-by-tofishes.html
- Sublime Text 3 LESS、SASS、SCSS高亮插件、提示插件
为sublime text 添加LESS语法高亮 功能:LESS高亮插件 下载 https://packagecontrol.io/packages/LESS 简介:用LESS的同学都知道,s ...
- PHP全局变量
1.global 关键字 2.$GLOBALS 3.使用静态变量
- TDirectory.GetLastAccessTime获取指定目录最后访问时间
使用函数: System.IOUtils.TDirectory.GetLastAccessTime 函数定义: class function GetLastAccessTime(const Path: ...
- xcopy总是询问是文件名还是目录名
我需要运行类似xcopy /y a.xml .\pics\b.xml很多次,但xcopy总是问我“文件名还是目录名” 可以这样通过管道来做echo f | xcopy /y a.xml .\pics\ ...
- linux常用命令搜索
解压tar - xzvf webcmp.tar.gz /目的目录 压缩tar - czvf webcmp.tar.gz /压缩源文件 发包命令 cd /cap/sc_bossdata_20140516 ...
- 【ASP.NET】从服务器端注册客户端脚本
一.在Asp.net 服务端处理脚本,一般都用 ClientScriptManager ,即web窗体服务端的this.ClientScript.该对象比较常用的方法: 1.RegisterArray ...
- 7 -- Spring的基本用法 -- 8...
7.8 深入理解容器中的Bean 7.8.1 抽象Bean与子Bean 把多个<bean.../>配置中相同的信息提取出来,集中成配置模版------这个配置模版并不是真正的Bean,因此 ...