3855 | 2023-03-03 12:14:11 | Matematika | Kövek (100 pont) | cpp17 | Compilation error |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
int atlag;
int lepesek=0;
int osszeg=0;
cin >> n;
vector<int> vec(n);
for(int i=0; i<n ; i++)
{
cin >> vec[i];
atlag=atlag+vec[i];
}
atlag=atlag/n;
for(int i=0; i<n; i++)
{
osszeg=osszeg+vec[i];
if(osszeg==atlag*(i+1)
{
lepesek++;
}
}
lepesek=n-lepesek;
cout << lepesek;
return 0;
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:22:31: error: expected ')' before '{' token
22 | if(osszeg==atlag*(i+1)
| ~ ^
| )
23 | {
| ~
main.cpp:26:5: error: expected primary-expression before '}' token
26 | }
| ^
Exited with error status 1