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;
}


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

posted on 2015-05-28 11:20  王老大-  阅读(145)  评论(0编辑  收藏  举报

导航