记录编号 | 129316 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 136.[USACO Feb08] 奶牛式乘法 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.011 s | ||
提交时间 | 2014-10-19 19:33:51 | 内存使用 | 0.29 MiB | ||
#include <cstdio> using namespace std; int sza[110],szb[110]; long long a,b,ans=0; int main() { freopen("cowmult.in","r",stdin); freopen("cowmult.out","w",stdout); scanf("%lld%lld",&a,&b); long long x=a,y=b,tx=1,ty=1; while(x) { sza[tx]=x%10; x=x/10; tx++; } while(y) { szb[ty]=y%10; y=y/10; ty++; } for(int i=1;i<=tx;i++) { for(int j=1;j<=ty;j++) { ans+=sza[i]*szb[j]; } } printf("%lld\n",ans); fclose(stdin); fclose(stdout); return 0; }