ACM PKU 1298 The Hardest Problem Ever  小小的难点:传递字符串参数

http://acm.pku.edu.cn/JudgeOnline/problem?id=1298
很简单,几乎没有"算法"可言
注意: 1.不要用scanf()来读字符串,因为scanf()会把空格当作分隔符,在本题中是不符合题意的;2.注意传递字符串参数后,有个gets()相当精髓.
Source Code

Problem: 
1298  User: lnmm 
Memory: 56K  Time: 0MS 
Language: C
++  Result: Accepted 

Source Code 
#include
"stdio.h"
#include
"string.h"

void decipher(char * message)
{
    
char plain[]="VWXYZABCDEFGHIJKLMNOPQRSTU";
    
char cipherEnd[201];
    
int i,cipherLen;
      gets(message);  
//史上最精髓的一个gets()
    cipherLen=strlen(message);
    
for(i=0;i<cipherLen;i++)
        
if(message[i]>='A'&&message[i]<='Z')message[i]=plain[message[i]-'A'];
        gets(cipherEnd);
        
return;
}


void main()
{
    
char message[201];
    gets(message);
    
while(strcmp(message,"START")==0){
        decipher(message);
        printf(
"%s\n",message);
        gets(message);
    }

}

posted on 2007-11-13 16:14 流牛ζ木马 阅读(1013) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2007年11月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

导航

统计

公告

MY Email/MSN :mars1021@163.com QQ : 27402040 流牛ζ木马

常用链接

留言簿(6)

随笔档案

相册

搜索

最新随笔

最新评论

阅读排行榜

评论排行榜