题解 | 凯撒加密
凯撒加密
https://www.nowcoder.com/practice/006b7917d3784371a43cfbae01a9313d
#include <iostream>
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
for(int i = 0 ;i<s.size();i++)
{
char* c = &s[i];
int orignal_pos = *c - 'a';
int new_pos = (orignal_pos+n) % 26;
*c = new_pos + 'a';
}
cout << s ;
}
// 64 位输出请用 printf("%lld")
OPPO公司福利 1202人发布