#include<stdio.h> long long a,b; int x[20]; int y[20]; void solve() { int i=0; int j=0; int xn=0; int yn=0; while(a) { x[i++]=a%10; a/=10; } xn=i; i=0; while(b) { y[i++]=b%10; b/=10; } yn=i; long long sum=0; for(i=0;i<xn;++i) for(j=0;j<yn;++j) { sum+=x[i]*y[j]; } printf("%lld\n",sum); } int main(int argc, char *argv[]) { // freopen("1083.in", "r", stdin); while(~scanf("%lld %lld",&a,&b)) { solve(); } return 0; } /************************************************************** Problem: 1083 User: kirchhoff Language: C Result: Accepted Time:0 ms Memory:912 kb ****************************************************************/
原文地址:http://blog.csdn.net/wdkirchhoff/article/details/41943931