Advertisement
wojiaocbj

Untitled

May 25th, 2023
683
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.04 KB | None | 0 0
  1. /*
  2.  Author: 曹北健
  3.  Result: AC Submission_id: 5469064
  4.  Created at: Thu May 25 2023 20:49:51 GMT+0800 (China Standard Time)
  5.  Problem_id: 6933   Time: 9 Memory: 1600
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <math.h>
  12. #include <ctype.h>
  13. #pragma warning(disable:4996 6031)
  14. int main(){
  15. #ifdef _DEBUG
  16.     freopen("../../input.txt", "r", stdin);
  17. #endif // _DEBUG
  18.     char s[256] = { 0 };
  19.     long long b[256] = { 0 }, a[256] = { 0 };
  20.     int i, n;
  21.     long long k, m = 1;
  22.     scanf("%lld%s", &k, s);
  23.     for(i = 0; s[i]; i++){
  24.         a[i] = s[i] - 'a';
  25.     }
  26.     n = i;
  27.     b[0] = (a[0] + k * (m - 13)) % 26;
  28.     if(b[0] < 0){
  29.         b[0] += 26;
  30.     }
  31.     for(i = 1; i < n; i++){
  32.         m = b[i - 1];
  33.         b[i] = (a[i] + k * (m - 13)) % 26;
  34.         if(b[i] < 0){
  35.             b[i] += 26;
  36.         }
  37.     }
  38.     for(i = 0; i < n; i++){
  39.         putchar('a' + b[i]);
  40.     }
  41.     putchar('\n');
  42. #ifdef _DEBUG
  43.         freopen("CON", "r", stdin);
  44.     system("pause");
  45. #endif // _DEBUG
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement