【題解】ZeroJudge b428: 凱薩加密

【題目敘述】https://zerojudge.tw/ShowProblem?problemid=b428
【Tag】字串、字元、ASCII

#include <iostream>
using namespace std;
 
int main()
{
    string s, t;
    int k;
    while (cin >> s >> t) {
        k = t[0] - s[0];
        if (k < 0) {
            k += 26;
        }
        cout << k << endl;
    }
}
分享本文 Share with friends