九度OJ 1083: 特殊乘法
2014-01-26 23:16
239 查看
题目描述:
写个算法,对2个小于1000000000的输入,求结果。
特殊乘法举例:123 * 45 = 1*4 +1*5 +2*4 +2*5 +3*4+3*5
输入:
两个小于1000000000的数
输出:
输入可能有多组数据,对于每一组数据,输出Input中的两个数按照题目要求的方法进行运算后得到的结果。
样例输入:
样例输出:
来源:
2010年清华大学计算机研究生机试真题
写个算法,对2个小于1000000000的输入,求结果。
特殊乘法举例:123 * 45 = 1*4 +1*5 +2*4 +2*5 +3*4+3*5
输入:
两个小于1000000000的数
输出:
输入可能有多组数据,对于每一组数据,输出Input中的两个数按照题目要求的方法进行运算后得到的结果。
样例输入:
123 45
样例输出:
54
来源:
2010年清华大学计算机研究生机试真题
题目分析:
乘法分配率的水题。源代码:
#include <stdio.h> #include <stdlib.h> int main() { int m, n; while(scanf("%d%d", &m, &n) != EOF) { int a = 0; int b = 0; while(m) { a += m%10; m /= 10; } while(n) { b += n%10; n /= 10; } printf("%d\n", a*b); } //system("pause"); return 0; } /************************************************************** Problem: 1083 User: superlc320 Language: C++ Result: Accepted Time:0 ms Memory:1020 kb ****************************************************************/
相关文章推荐
- 九度OJ 1083 特殊乘法 (模拟)
- 九度OJ 题目1083:特殊乘法
- 九度OJ 1083 特殊乘法
- 九度OJ特殊乘法1083
- 九度OJ 1083:特殊乘法 (基础题)
- 九度OJ 1083:特殊乘法 (基础题)
- 题目1083:特殊乘法
- 题目1083:特殊乘法(2010年清华大学计算机研究生机试真题)
- 九度题目:特殊乘法(1083)
- 题目1083:特殊乘法
- 九度OJ 题目1083:特殊乘法
- 九度OJ1083特殊乘法
- C++ 特殊乘法(九度OJ 1083)
- 39-题目1083:特殊乘法
- 九度 题目1083:特殊乘法
- 题目1083:特殊乘法
- 九度 1083:特殊乘法(模拟)
- 九度1083:特殊乘法
- 题目1083:特殊乘法
- 九度 Online Judge 算法 刷题 题目1083:特殊乘法