1048. Digital encryption (20) time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, Yue
A digital encryption method is required for this subject. First fixed an encryption with a positive integer A, any positive integer b, each of its 1 digits and a corresponding position on the number of the following operation: to the odd digits, the corresponding bit of the number added to 13 to take the remainder--here with J for 10, Q for 11, K for 12, and dual digits minus a number of a number, If the result is negative, then add 10. This makes the digit 1th.
Input format:
The input is given a and b in a row, each of which is a positive integer of no more than 100 bits, separated by a space.
Output format:
Outputs the encrypted result in a row.
Input Sample:
1234567 368782971
Sample output:
3695q8118
1#include <stdio.h>2#include <string.h>3 intMain () {4 Charaa[101]={0},bb[101]={0},sb[101]={0},ab[ -]="0123456789JQK";5scanf"%s%s", AA,BB);6 intb;7A=strlen (AA), b=strlen (BB);8 if(b<a)9 {Tenmemset (SB,'0', A-b); Oneb=A; A } - strcat (SB,BB); - for(intI=1; i<=a;i++){ the if(i%2==0) -Sb[b-i]= (sb[b-i]-aa[a-i]+Ten)%Ten; - if(i%2==1) -Sb[b-i]= (aa[a-i]- -+sb[b-i]- -)% -; + } - for(intI=0; i<b;i++) +printf"%c", i<b-a?Sb[i]:ab[sb[i]]); A return 0; at}
pat-B-1048. Digital encryption (20)