Thursday, December 18, 2014

ACM 1404. Easy to Hack! / Легко взломать!

 We need to implement the reverse process in order to solve this task, Suppose we have the array of new characters where each character is written as a number. For every sum[i] the real char in that spot will be sum[i]-sum[i-1] .We just need to loop over and recover the initial string, every s[i]=a[i]-a[i-1], and in the end s[0]=s[0]-5. Also, during this process we need to check for the subtraction not get lower than 0, in that case just add 26 to the negative result to turn it into positive.

  


        FULL SOURCE CODE

 


No comments:

Post a Comment