codeup 1906 特殊乘法
2017-08-12 21:29
141 查看
codeup 1906 特殊乘法
题目描述
写个算法,对2个小于1000000000的输入,求结果。特殊乘法举例:123 * 45 = 1*4 +1*5 +2*4 +2*5 +3*4+3*5输入
两个小于1000000000的数输出
输入可能有多组数据,对于每一组数据,输出Input中的两个数按照题目要求的方法进行运算后得到的结果。解题代码
#include <iostream> #include <string> using namespace std; int main() { string a,b; long long ans; while(cin>>a>>b) { int len1 = a.length(); int len2 = b.length(); ans =0; for(int i=0;i<len1;i++) for(int j=0;j<len2;j++) { ans += (a[i]-'0')*(b[j]-'0'); } cout<<ans<<endl; } return 0; }
相关文章推荐
- jobdu 39 特殊乘法
- 特殊乘法(笛卡尔积)
- 九度OJ 1083: 特殊乘法
- 题目1083:特殊乘法
- 题目39:特殊乘法
- 特殊乘法(C#)
- 代码练习系列:特殊乘法
- 特殊乘法
- 题目39:特殊乘法
- Fzoj 1692 Problem 1692 Key problem [特殊矩阵的n^2复杂度求矩阵乘法]
- 九度OJ-1083-特殊乘法
- 九度题目:特殊乘法(1083)
- 特殊乘法(C#)
- 【慢慢学算法】:特殊乘法
- codeup代码练习-特殊乘法
- 题目1083:特殊乘法(2010年清华大学计算机研究生机试真题)
- 【POJ】3150 Cellular Automaton(矩阵乘法+特殊的技巧)
- 九度OnlineJudge题目1083:特殊乘法
- 【九度OJ】题目1083:特殊乘法 解题报告
- 特殊乘法