pat-B-1048. Digital encryption (20)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.