The meaning of the question is hard to understand. Simply put, we will give you a string. Each character occupies one byte (in December 256), followed by two more bytes, so that the total value of the string can be fully divided by 34943, finally, the hexadecimal values of the two characters are output.
The Code is as follows:
# Include <cstdio> # include <cmath> # include <cstring> char str [1030]; const int MAX = 34943; int main () {# ifdef test freopen ("sample.txt", "r", stdin); # endif int len; char s [5]; while (gets (str )) {if (str [0] = '#') break; len = strlen (str); if (! Len) {printf ("00 00 \ n"); continue;} long ans = 0; for (int I = 0; I <len; I ++) ans = (ans <8) + str [I]) % MAX; ans = (ans <16) % MAX; // the number to be added is 34943-ans, then convert to hexadecimal; ans = MAX-ans; for (int I = 3; I> = 0; I --) {int res = ans % 16; if (res <10) s [I] = res + '0'; else s [I] = res-10 + 'a'; ans/= 16 ;} printf ("% c \ n", s [0], s [1], s [2], s [3]);} return 0 ;}