hdu1048 The Hardest Problem Ever
来源:互联网 发布:联合培养博士 知乎 编辑:程序博客网 时间:2024/05/22 17:00
#include <stdio.h>
#include <string.h>
int main()
{
int i,j,len;
char st1[50],st2[500],st3[50];
while(gets(st1))
{
if(strcmp(st1,"ENDOFINPUT")==0) break;
gets(st2);
len=strlen(st2);
for(i=0;i<len;i++)
{
if(st2[i]>='A'&&st2[i]<='Z')
{
if(st2[i]=='A') st2[i]='V';
else if(st2[i]=='B') st2[i]='W';
else if(st2[i]=='C') st2[i]='X';
else if(st2[i]=='D') st2[i]='Y';
else if(st2[i]=='E') st2[i]='Z';
else st2[i]=st2[i]-5;
}
}
gets(st3);
for(i=0;i<len;i++)
printf("%c",st2[i]);
printf("\n");
}
return 0;
#include <string.h>
int main()
{
int i,j,len;
char st1[50],st2[500],st3[50];
while(gets(st1))
{
if(strcmp(st1,"ENDOFINPUT")==0) break;
gets(st2);
len=strlen(st2);
for(i=0;i<len;i++)
{
if(st2[i]>='A'&&st2[i]<='Z')
{
if(st2[i]=='A') st2[i]='V';
else if(st2[i]=='B') st2[i]='W';
else if(st2[i]=='C') st2[i]='X';
else if(st2[i]=='D') st2[i]='Y';
else if(st2[i]=='E') st2[i]='Z';
else st2[i]=st2[i]-5;
}
}
gets(st3);
for(i=0;i<len;i++)
printf("%c",st2[i]);
printf("\n");
}
return 0;
}
心得:字符串比较用strcmp.
0 0
- HDU1048 The Hardest Problem Ever
- hdu1048 The Hardest Problem Ever
- HDU1048 The Hardest Problem Ever
- hdu1048 The Hardest Problem Ever
- HDU1048 The Hardest Problem Ever
- hdu1048 The Hardest Problem Ever
- hdu1048 The Hardest Problem Ever
- HDU1048——The Hardest Problem Ever
- The Hardest Problem Ever(hdu1048字符串水题)
- HDU1048 - The Hardest Problem Ever (简单题)
- hdu1048 The Hardest Problem Ever(C语言)
- The Hardest Problem Ever
- The Hardest Problem Ever
- The Hardest Problem Ever
- The Hardest Problem Ever
- The Hardest Problem Ever
- The Hardest Problem Ever
- The Hardest Problem Ever
- 大数字相加
- MyISAM vs InnoDB 分析之一
- HashTable的实现原理分析
- ocp-38
- hdu 1429 状态搜索
- hdu1048 The Hardest Problem Ever
- awk 正则表达式、正则运算符详细介绍
- 【C语言】双向链表的实现
- pch文件 解决每个文件都需要重复引入的问题
- android--Activity窗口切换(左右滑动)
- IOS动画效果
- ocp-39
- UVa12171 Sculpture
- 面试题24:二叉搜索树的后序遍历序列