| 21747 | 2026-01-13 18:59:47 | Zsolt | Zenehallgatás | cpp17 | Forditási hiba |
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_studio(false);
cin.tie(nullptr);
int n,k,ossz=0;
cin>>n>>k;
vector<int>hossz(n);
for(int i=0; i<n; i++)
{
cin>>hossz[i];
}
for(int i=1; i<n; i++)
{
hossz[i]+=hossz[i-1];
}
int x,m;
for(int i=0; i<k; i++)
{
cin>>x;
m=x%hossz[n-1];
if(m==0)
{
cout<<n;
}
else
{
cout<<lower_bound(hossz.begin(),hossz.end(),m)-hossz.begin()+1<<" ";
}
}
return 0;
}
open /var/local/lib/isolate/404/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:7:10: error: 'sync_with_studio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
7 | ios::sync_with_studio(false);
| ^~~~~~~~~~~~~~~~