zoukankan      html  css  js  c++  java
  • 每日一九度之 题目1083:特殊乘法

    时间限制:1 秒

    内存限制:32 兆

    特殊判题:

    提交:5319

    解决:3606

    题目描述:

    写个算法,对2个小于1000000000的输入,求结果。

    特殊乘法举例:123 * 45 = 1*4 +1*5 +2*4 +2*5 +3*4+3*5

    输入:

     两个小于1000000000的数

    输出:

     输入可能有多组数据,对于每一组数据,输出Input中的两个数按照题目要求的方法进行运算后得到的结果。

    样例输入:
    123 45
    样例输出:
    54

    按题目直接模拟就好。

    //Asimple
    #include <iostream>
    #include <algorithm>
    #include <cstring>
    #include <cstdio>
    #include <vector>
    #include <cctype>
    #include <cstdlib>
    #include <stack>
    #include <cmath>
    #include <set>
    #include <map>
    #include <string>
    #include <queue>
    #include <limits.h>
    #define INF 0x7fffffff
    using namespace std;
    const int maxn = 55;
    typedef long long ll;
    ll sum = 0;
    char s1[maxn], s2[maxn];
     
    int main(){
        while( ~scanf("%s %s",s1, s2) ){
            sum =0;
            for(int i=0; s1[i]!=''; i++){
                for(int j=0; s2[j]!=''; j++){
                    sum += (s1[i]-'0')*(s2[j]-'0');
                }
            }
            printf("%ld
    ",sum);
        }
        return 0;
    }
    低调做人,高调做事。
  • 相关阅读:
    软件对标分析
    第一阶段绩效评估
    自律小帮手:Alpha版使用说明
    团队 电梯演讲 原型展示
    意见评论
    Alpha版(内部测试版)发布
    意见汇总
    产品对比
    团队项目-第二阶段冲刺-3
    团队项目-第二阶段冲刺-2
  • 原文地址:https://www.cnblogs.com/Asimple/p/5965301.html
Copyright © 2011-2022 走看看