1133:输出亲朋字符串
生活随笔
收集整理的這篇文章主要介紹了
1133:输出亲朋字符串
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
時間限制: 1000 ms 內存限制: 65536 KB
提交數: 5873 通過數: 4388
【題目描述】
編寫程序,求給定字符串s的親朋字符串s1。
親朋字符串s1定義如下:給定字符串s的第一個字符的ASCII值加第二個字符的ASCII值,得到第一個親朋字符; 給定字符串s的第二個字符的ASCII值加第三個字符的ASCII值,得到第二個親朋字符;依此類推,直到給定字符串s的倒數第二個字符。親朋字符串的最后一個字符由給定字符串s的最后一個字符ASCII值加s的第一個字符的ASCII值。
【輸入】
輸入一行,一個長度大于等于2,小于等于100的字符串。字符串中每個字符的ASCII值不大于63。
【輸出】
輸出一行,為變換后的親朋字符串。輸入保證變換后的字符串只有一行。
【輸入樣例】
1234
【輸出樣例】
cege
【來源】
No
code
/*^....0^ .1 ^1^.. 011.^ 1.0^ 1 ^ ^0.11 ^ ^..^0. ^ 0^.0 1 .^.1 ^0 .........001^.1 1. .111100....01^00 ^ 11^ ^1. .1^1.^ ^0 0^.^ ^0..1.1 1..^1 .0 ^ ^^ 00. ^^0.^1 ^ 0 ^^110.^0. 0 ^ ^^^10.01^^ 010^ 1 1 ^^^1110.10001 10 0 ^ 1.1 ^^^11111100^ 10 . 01 ^^ ^^ ^^^1111^1.^ ^^^10 10^ 0^ ^^111^^^0.1^ 1....^11 0 ^^11^^^ 0.. ....1^ ^ ^1. 0^ ^11^^^ ^ 1 111^ ^ 0.10 00 11 ^^^^^ 1 0 1.0^ ^0 ^0 ^^^^ 0 0.0^ 1.0 .^ ^^^^ 1 1 .0^.^ ^^ 0^ ^1 ^^^^ 0. ^.11 ^ 11 1. ^^^ ^ ^ ..^^..^ ^1 ^.^ ^^^ .0 ^.00..^ ^0 01 ^^^ .. 0..^1 .. .1 ^.^ ^^^ 1 ^ ^0001^ 1. 00 0. ^^^ ^.0 ^.1. 0^. ^.^ ^.^ ^^^ ..0.01 .^^. .^ 1001 ^^ ^^^ . 1^. ^ ^. 11 0. 1 ^ ^^ 0.0 ^. 0 ^0 1 ^^^ 0.0.^ 1. 0^ 0 .1 ^^^ ...1 1. 00 . .1 ^^^ ..1 1. ^. 0 .^ ^^ ..0. 1. .^ . 0 ..1 1. 01 . . ^ 0^.^ 00 ^0 1. ^ 1 1.0 00 . ^^^^^^ ..^ 00 01 ..1. 00 10 1 ^^.1 00 ^. ^^^ .1.. 00 .1 1..01 ..1.1 00 1. ..^ 10^ 1^ 00 ^.1 0 1 1.1 00 00 ^ 1 ^. 00 ^.^ 10^ ^^1.1 00 00 10^..^ 1. ^. 1.0 1 ^. 00 00 .^^ ^. ^ 1 00 ^0000^ ^ 011 0 ^. 00.0^ ^00000 1.00.1 11. 1 0 1^^0.01 ^^^ 01.^ ^ 1 1^^ ^.^1 1 0... 1 ^1 1^ ^ .01 ^ 1.. 1.1 ^0.0^ 0 1..01^^100000..0^1 1 ^ 1 ^^1111^ ^^0 ^ ^ 1 1000^.1 ^.^ . 00.. 1.1 0. 01. . 1. .^1. 1 1. ^0^ . ^.1 00 01^.0 001. .^*/ // An_all_in_one_book_on_Informatics —— 1133.cpp created by VB_KoKing on 2019,04,29,08. /* Procedural objectives:Variables required by the program:Procedural thinking:Functions required by the program:*/ /* My dear Max said: "I like you, So the first bunch of sunshine I saw in the morning is you, The first hurricane that passed through your ear is you, The first star you see is also you. The world I see is all your shadow."FIGHTING FOR OUR FUTURE!!! */ #include <iostream> #include <string> using namespace std; int main() {string str;cin>>str;for (int i = 0; i < str.length(); i++)cout<<char(str[i]+str[(i+1)%str.length()]);return 0; }總結
以上是生活随笔為你收集整理的1133:输出亲朋字符串的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Stable Sort Aizu - A
- 下一篇: 1134:合法C标识符查