QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#588510#9375. TouristmwhCompile Error//C++20334b2024-09-25 12:31:372024-09-25 12:31:37

Judging History

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

  • [2024-09-25 12:31:37]
  • 评测
  • [2024-09-25 12:31:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	long long n,m,ans=1500;
	cin>>n;
	bool flag=false;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		ans+=a;
		if(ans>=4000)flag=true,m=i+1,break;
	}
	if(flag)cout<<m<<endl;
	else cout<<"-1"<<endl;
	return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:13:46: error: expected primary-expression before ‘break’
   13 |                 if(ans>=4000)flag=true,m=i+1,break;
      |                                              ^~~~~