poj 2316 SPIN

来源:互联网 发布:coap协议默认的端口号 编辑:程序博客网 时间:2024/04/30 20:24

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


0 0
原创粉丝点击