QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#387402 | #6748. Spin the Wheel | k1nsom | Compile Error | / | / | C++17 | 513b | 2024-04-12 14:41:10 | 2024-04-12 14:41:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define int long long
#define endl '\n'
int ans = 0, n, gc, a[N];
signed main()
{
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
gc = (a[2] - a[1] + n - 1) % n + 1; // 公差
for (int i = 2; i <= n; i++)
if ((a[i % n + 1] - a[i] + n - 1) % n + 1 != gc)
{
cout << -1;
// cout << i;
return 0;
}
cout << ((a[i] == 0) + gc);
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:20:17: error: ‘i’ was not declared in this scope 20 | cout << ((a[i] == 0) + gc); | ^