Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: 曹北健
- Result: AC Submission_id: 5469064
- Created at: Thu May 25 2023 20:49:51 GMT+0800 (China Standard Time)
- Problem_id: 6933 Time: 9 Memory: 1600
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- #include <ctype.h>
- #pragma warning(disable:4996 6031)
- int main(){
- #ifdef _DEBUG
- freopen("../../input.txt", "r", stdin);
- #endif // _DEBUG
- char s[256] = { 0 };
- long long b[256] = { 0 }, a[256] = { 0 };
- int i, n;
- long long k, m = 1;
- scanf("%lld%s", &k, s);
- for(i = 0; s[i]; i++){
- a[i] = s[i] - 'a';
- }
- n = i;
- b[0] = (a[0] + k * (m - 13)) % 26;
- if(b[0] < 0){
- b[0] += 26;
- }
- for(i = 1; i < n; i++){
- m = b[i - 1];
- b[i] = (a[i] + k * (m - 13)) % 26;
- if(b[i] < 0){
- b[i] += 26;
- }
- }
- for(i = 0; i < n; i++){
- putchar('a' + b[i]);
- }
- putchar('\n');
- #ifdef _DEBUG
- freopen("CON", "r", stdin);
- system("pause");
- #endif // _DEBUG
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement