Initiate Luogu
This commit is contained in:
27
Luogu/P1914 小书童——凯撒密码.cpp
Normal file
27
Luogu/P1914 小书童——凯撒密码.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
void pwd(char ch[52]){
|
||||
for(int i=0;i<strlen(ch);i++){
|
||||
if(ch[i]!='z'){
|
||||
ch[i]++;
|
||||
}
|
||||
if(ch[i]=='z')
|
||||
ch[i]='a';
|
||||
}
|
||||
}
|
||||
int main(){
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
char a[52];
|
||||
scanf("%s",a);
|
||||
for(int i=0;i<strlen(a);i++){
|
||||
if(a[i]+n>=123)
|
||||
a[i]+=n-26;
|
||||
else{
|
||||
a[i]+=n;
|
||||
}
|
||||
|
||||
}
|
||||
printf("%s",a);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user