122912024-12-11 12:53:26ruffbrigiZenehallgatáscpp17Forditási hiba
include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin>>n;
    cin>>k;
    long long t[n],p[k];
    cin>>t[0];
    for(int i=1;i<=n-1;i++)
    {
        cin>>t[i];
        t[i]+=t[i-1];
    }
    for(int j=0;j<=k-1;j++)
    {
        cin>>p[j];
        p[j]=p[j]%t[n-1];
    }
    for(int j=0;j<=k-1;j++)
    {
        if(p[j]==0) cout<<n<<" ";
        else
        {
            int i=0;
            while(t[i]<p[j])
            {
                i++;
            }
           cout<<i+1<<" ";
        }
    }
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/408/box/a.out: no such file or directory
main.cpp:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
main.cpp: In function 'int main()':
main.cpp:7:5: error: 'ios' has not been declared
    7 |     ios::sync_with_stdio(false);
      |     ^~~
main.cpp:8:5: error: 'cin' was not declared in this scope
    8 |     cin.tie(0);
      |     ^~~
main.cpp:9:5: error: 'cout' was not declared in this scope
    9 |     cout.tie(0);
      |     ^~~~