题解 | #特殊乘法#

特殊乘法

https://www.nowcoder.com/practice/a5edebf0622045468436c74c3a34240f

#include <iostream>
#include<string>
using namespace std;
int trans(char a) {
    int temp = a - '0';
    return temp;
}
int main() {
    string s1, s2;
    while (cin >> s1 >> s2) {
        int temp = 0;
        int num1 = s1.size();
        int num2 = s2.size();
        for (int i = 0; i < num1; i++) {
            for (int j = 0; j < num2; j++) {
                temp += trans(s1[i]) * trans(s2[j]);
            }
        }
        cout << temp << endl;
    }
}

全部评论

相关推荐

陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务