79062024-01-11 20:15:26CsongiZenehallgatáscpp17Compilation error
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<long long> hosszusagok(n);
    vector<long long> idopontok(k);
    unsigned long long egyloop = 0;
    for (i = 1; i <= n; i++)
    {
        cin >> hosszusagok[i];
        egyloop += hosszusagok[i];
    }

    for (int i = 1; i <= k; i++)
    {
        cin >> idopontok[i];
        int maradek = idopontok[i] % hosszusagok[n-1];
        cout << lower_bound(hosszusagok.begin(), hosszusagok.end(), idopontok[i]) - hosszusagok.begin() + 1 << " ";
    }
    return 0;
}
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:13:10: error: 'i' was not declared in this scope
   13 |     for (i = 1; i <= n; i++)
      |          ^
Exited with error status 1