Zoj 1006 Encryption

Source: Internet
Author: User

// Non-redundant Encryption
// Because the divisor and remainder are the same, and both are smaller than 28, the MOD is the same for each other.
# Include <iostream>
# Include <string>
Using namespace STD;
Char st [2, 100], en [2, 100];
Int stnum [100], ennum [100];

 

Int main ()
{
Int I, K, Len, Pos;
While (CIN> K & K! = 0)
{
Cin> st;
Len = strlen (ST );
For (I = 0; I <Len; I ++)
{
If (ST [I] = '.')
Stnum [I] = 27;
Else if (ST [I] = '_')
Stnum [I] = 0;
Else
Stnum [I] = sT [I]-'A' + 1;
}
For (I = 0; I <Len; I ++)
{
Pos = (k * I) % Len;
Ennum [POS] = (stnum [I] + I) % 28;
}

For (I = 0; I <Len; I ++)
{
If (ennum [I] = 27)
En [I] = '.';
Else if (ennum [I] = 0)
En [I] = '_';
Else
En [I] = ennum [I]-1 + 'a ';
}

for (I = 0; I cout cout }< br> return 0;
}

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.