题目
Calculate A * B.
Input
Each line will contain two integers A and B. Process to end of file.
Note: the length of each integer will not exceed 50000.
Output
For each case, output A * B in one line.
Sample Input
1
2
1000
2
Sample Output
2
2000
思路
这道题出的很好撒~ f f t fft fft的入门题目,真的很合适(强烈推荐!!!)
然后具体的 f f t fft fft学习,这里给出两个网址,讲的很不错 → → → f f t 学 习 1 fft学习1 fft学习1和 f f t 学 习 2 fft学习2 fft学习2
对这道题分析: 因为给出两个数字相乘,数字的长度不超过50000,如果用最基本的大数相乘,复杂度为 O ( n 2 ) O(n^2) O(n2),明显会超时,这里令 A = a 1 ∗ x 0 + a 2 ∗ x 1 + a 3 ∗ x 3 + . . . . . . a n ∗ x n A=a1*x^0+a2*x^1+a3*x^3+......an*x^n A=a1∗x0+a2∗<