QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#709684#9142. Uniting Amoebasrotcar07Compile Error//C++23273b2024-11-04 16:14:272024-11-04 16:14:28

Judging History

你现在查看的是最新测评结果

  • [2024-11-04 16:14:28]
  • 评测
  • [2024-11-04 16:14:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int mod=998244353;
int main(){
	int t;cin>>t;
	while(t--){
		int n;cin>>n;
		vector<long long> v(n);
		for(int &x:v) cin>>x;
		cout<<accumulate(v.begin(),v.end(),-*max_element(v.begin(),v.end()))<<'\n';
	}
}

Details

answer.code: In function ‘int main()’:
answer.code:9:28: error: cannot bind non-const lvalue reference of type ‘int&’ to a value of type ‘long long int’
    9 |                 for(int &x:v) cin>>x;
      |                            ^