poj 1298 The Hardest Problem Ever
生活随笔
收集整理的這篇文章主要介紹了
poj 1298 The Hardest Problem Ever
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題目鏈接:http://poj.org/problem?id=1298
題目大意:按照所給的順序要求將輸入的字符串進行排列。
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 int main () 6 { 7 char str[27]= {"VWXYZABCDEFGHIJKLMNOPQRSTU"}; 8 char ch[100]; 9 10 while (1) 11 { 12 gets(ch); 13 if (strcmp(ch,"START")==0)//strcmp是字符的一個函數,也就是兩者之間的比較 14 continue; 15 else if (strcmp(ch,"END")==0) 16 continue; 17 else if (strcmp(ch,"ENDOFINPUT")==0) 18 break; 19 for (int i=0; ch[i]!='\0'; i++) 20 { 21 if (!(ch[i]>='A'&&ch[i]<='Z')) 22 continue; 23 ch[i]=str[ch[i]-65];//運用ASCII進行字符之間的相互轉換 24 } 25 puts(ch); 26 } 27 return 0; 28 }?
轉載于:https://www.cnblogs.com/qq-star/p/3835612.html
總結
以上是生活随笔為你收集整理的poj 1298 The Hardest Problem Ever的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 把之前写的几个项目放到了github上
- 下一篇: 移动端前端开发注意点(未完待续)