題目連結 http://zerojudge.tw/ShowProblem?problemid=a009。此題用字元的 ASCII Code 來運算即可,而整數K到底是多少呢?
程式碼:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int k = -7; | |
char ch; | |
while( cin.get(ch) ) | |
{ | |
if( ch != '\n' ) | |
ch = ch + k; | |
cout << ch; | |
} | |
return 0; | |
} |
沒有留言:
張貼留言