You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
538 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int num = 0;
int a[4];
scanf("%d", &num);
a[0] = num / 1000;
a[1] = num / 100 % 10;
a[2] = num / 10 % 10;
a[3] = num % 10;
for (int i = 0; i < 4; i++) {
a[i] += 5;
a[i] %= 10;
}
for (int i = 0; i <= 3 / 2; i++) {
int tmp = a[i];
a[i] = a[3 - i];
a[3 - i] = tmp;
}
for (int i = 0; i < 4; i++) {
printf("%d", a[i]);
}
printf("\n");
return 0;
}