码迷,mamicode.com
首页 > 其他好文 > 详细

poj 2316 SPIN

时间:2015-05-28 12:40:56      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:c   poj   2316   

各个位相加对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;
}


poj 2316 SPIN

标签:c   poj   2316   

原文地址:http://blog.csdn.net/wangxinxin_/article/details/46119977

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!