poj 2316 SPIN

各个位相加对10取余。


#include <iostream>

using namespace std;

string st, res;

int main()
{
    getline(cin, res);
    while (getline(cin, st)  &&  st != "")
    {
        for (int i = 0; i < st.length(); i++)
            res[i] = ((res[i] - '0') + (st[i] - '0'))%10 + '0';
    }
    cout <<res << endl;
    return 0;
}


版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/wanglaoda/p/4937119.html