ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212557 | #3839. 小t爱算数(mul) | ChenHanzhang | Compile Error | / | / | C++ | 571b | 2024-10-19 11:25:13 | 2024-10-19 12:35:16 |
answer
#include<bits/stdc++.h>
using namespace std;
map<int,int>a;
map<int,int>b;
int main(){
int x,y,maxn=INT_MIN,maxm=INT_MIN;
while(cin>>x){
if(x==-1) break;
cin>>y;
a[x]+=y;
maxn=max(maxn,x);
}
while(cin>>x){
if(x==-1) break;
cin>>y;
maxm=max(maxm,x);
for(auto &&i:a) b[i.first+x]+=i.second*y;
}
for(int i=maxn+maxm;i>=0;i--){
if(b[i]==0) continue;
if(i==maxn+maxm){
cout<<b[i];
if(i!=0) cout<<"x^"<<i;
}else{
if(b[i]>0) cout<<"+";
cout<<b[i];
if(i!=0) cout<<"x^"<<i;
}
}
cout<<endl;
return 0;
}
详细
answer.code: In function 'int main()': answer.code:17:12: error: expected unqualified-id before '&&' token for(auto &&i:a) b[i.first+x]+=i.second*y;\x0d ^ answer.code:17:12: error: expected ';' before '&&' token answer.code:17:15: error: expected ';' before ':' token for(auto &&i:a) b[i.first+x]+=i.second*y;\x0d ^ answer.code:17:15: error: expected primary-expression before ':' token answer.code:17:15: error: expected ')' before ':' token answer.code:17:15: error: expe...