题解 | #特殊乘法#

特殊乘法

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

#include <stdio.h>
#include <string.h>

int main() {
    int result = 0;
    char s1[20];
    char s2[20];
    scanf("%s%s", &s1, &s2);
    int l1 = strlen(s1);
    int l2 = strlen(s2);
    for (int i = 0; i < l1; i++) {
        char temp1 = s1[i];
        for (int j = 0; j < l2; j++) {
            char temp2 = s2[j];
            result += (temp1 - '0') * (temp2 - '0');
        }
    }
    printf("%lld", result);
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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