乘法问题
奶牛的乘法查看 提交 统计 提问 时间限制: 1000ms 内存限制: 10000kB 描述
Bessie is tired of multiplying pairs of numbers the usual way,
so she invented her own style of multiplication. In her style, A*B is equal
to the sum of all possible pairwise products between the digits of A and B. For example,
the product 123*45 is equal to 1*4 + 1*5 + 2*4 + 2*5 + 3*4 + 3*5 = 54. Given two integers A and B
(1 ≤A, B ≤1,000,000,000), determine A*B in Bessie's style of multiplication.
输入
The first line of input gives the number of test cases, 1 ≤ t ≤ 100.
Each test case contains two integers A and B.
输出
Output for each test case a line with the A*B in Bessie's style of multiplication.
样例输入
2
123 45
1 12
样例输出
54
3
一道练习,我的想法很简单就是循环取余将数放入数组中在进行乘法运算,不过没有完成总觉得缺点什么?找找高手帮帮吧