QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#379280#6748. Spin the WheelRykonyCompile Error//C++20535b2024-04-06 16:54:282024-04-06 16:54:29

Judging History

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

  • [2024-04-06 16:54:29]
  • 评测
  • [2024-04-06 16:54:28]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define int long long

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int _=1;
//	cin>>_;
	while (_--){
		int n;
		cin>>n;
		vector <int> a(n+10);
		for (int i=1;i<=n;i++) cin>>a[i];
		int ky=(a[2]-a[1]+n)%n;
		int ans=0;
		for (int i=1;i<=n;i++){
			if ((a[i%n+1]-a[i]+n)%n!=ky){
				ans=-1;
				break;
			}
		}
		if (ans==-1) cout<<ans<<'\n';
		else{
			if (a[1]&&ky==0) cout<<n+1<<'\n';
			else out<<(a[1]?ky+1:ky)<<'\n';
		}
	}
}

Details

answer.code: In function ‘int main()’:
answer.code:28:30: error: ‘out’ was not declared in this scope
   28 |                         else out<<(a[1]?ky+1:ky)<<'\n';
      |                              ^~~