Created
May 25, 2012 00:15
-
-
Save yuuki/2785033 to your computer and use it in GitHub Desktop.
SRM Div2-147 250score
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
using namespace std; | |
class CCipher | |
{ | |
public: | |
string decode(string cipherText, int shift) | |
{ | |
for (int i = 0; i < cipherText.size(); ++i) { | |
if (cipherText[i] - shift < 'A') { | |
cipherText[i] = 'Z' + cipherText[i] - shift - 'A' + 1; | |
} else { | |
cipherText[i] -= shift; | |
} | |
} | |
return cipherText; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment