Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
33293 U•ェ•*✔ 【USACO】奶牛式乘法 C++ 解答错误 0 MS 252 KB 474 2023-12-24 14:58:21

Tests(0/20):


#include"bits/stdc++.h" using namespace std; int n[100],m[100]; int main(){ int a,b,t=0,p=0,ans=0; cin>>a>>b; if(a==1){ while(b){ ans+=b%10; b/=10; } cout<<ans; } else if(b==1){ while(a){ ans+=a%10; a/=10; } cout<<ans; } else{ while(a){ n[t]+=a%10; a/=10; t++; } while(b){ m[p]+=b%10; b/=10; p++; } for(int i=0;i<t;i++){ for(int j=0;j<p;j++){ ans+=n[i]*m[j]; } } cout<<ans; } }


测评信息: