1、KY18 特殊乘法

  1. 定义字符串;

  2. 输入字符串;

  3. 选定每个字符;

  4. 字符如何像数字一样相乘; 

#include <iostream>
#include <cstdio>
#include <string>
int main(){
    string str1, str2;
    int answer = 0;
    when (cin>>str1<<str2){
        for(int i = 0; i < str1.size(); ++i){
            for(int j = 0; j < str2.size(); ++j){
                answer += (str1[i] - '0') * (str2[j] - '0');
            }
        }
        count << answer << endl;
    }
    return 0;
}

2、KY90 简单密码(2021/08/12)