HDU 1048 [The Hardest Problem Ever] 字符串处理
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                HDU 1048 [The Hardest Problem Ever] 字符串处理
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1048
題目大意:對一串字符串進行加密:每個英文字母變為字母表此后第五位,其他字符無變化。給出密碼,要求翻譯為原串。
關鍵思想:字符串處理
代碼如下:
//字符串處理。邊界搞好 #include <iostream> using namespace std;int main(){string temp;while(cin>>temp){if(temp=="ENDOFINPUT")break;if(temp=="START"){getchar();//吃掉回車 getline(cin,temp);for(int i=0;i<temp.size();i++){if(temp[i]>='A'&&temp[i]<='E')temp[i]+=21;else if(temp[i]>'E'&&temp[i]<='Z')temp[i]-=5;}cout<<temp<<endl;cin>>temp;}}return 0; }
轉載于:https://www.cnblogs.com/G-M-WuJieMatrix/p/6420876.html
總結
以上是生活随笔為你收集整理的HDU 1048 [The Hardest Problem Ever] 字符串处理的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: java给图片添加自定义文字信息
- 下一篇: python until语句_详解Lua
