Advertisement
_takumi

id2

Dec 23rd, 2022
871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(int argc, char *argv[]) {
  6.     int n = 0, cnt = 0;
  7.     char map[9][5] = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};
  8.     char *dest = (char *) malloc(1024);
  9.     scanf("%[^\n]dest", dest);
  10.     n = strlen(dest);
  11.     char *res = (char *) malloc(4 * n + 1);
  12.     for (int i = 0; i < n; ++i) {
  13.         strcpy(res + cnt, map[dest[i] - '0' - 1]);
  14.         cnt += strlen(map[dest[i] - '0' - 1]);
  15.     }
  16.     printf("%s\n", res);
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement