大佬们我这个为啥有问题啊
查看原帖
大佬们我这个为啥有问题啊
826232
z7k123楼主2024/4/5 20:51
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string pas;
	cin >> n >> pas;
	string pas1 = "abcdefghijklmnopqrstuvwsyz"; 
	for(int i=0; i<pas.size(); ++i){
		if(pas[i]+n <= 122){
			char t = pas[i]+n;
			cout << t;
		}else{
			int res = (pas[i]+n) % 123;
			char t1 = pas1[res];
			cout << t1;
		}
	}
	return 0;
}

系统提示报错为这个 26 qwertyuiopasdfghjklzxcvbnm 输出为:qwertyuiopasdfghjklzxcvbnm 我测试输出为 qwertyuiopasdfghjklzxcvbnm 有点疑惑

2024/4/5 20:51
加载中...