41372023-03-15 13:40:42gittyLeggyorsabb pénzkeresés (50)cpp17Forditási hiba
#include <iostream>
#include <queue>
#include <fstream>
using namespace std;

int main()
{
    //ifstream cin("in.txt");
    queue <int> pieces;
    int n, p;
    cin>>n>>p;
    f>>n>>p;
    int x;
    int s=0;
    int minl=100000;
    //cout<<n<<" "<<p;
    for(int i =1; i<=n; i++)
    {
        //f>>x;
        cin>>x;
        if(s+x < p)
        {
            s+=x;
            pieces.push(x);
        }
        else
        {
            while(s-pieces.back() > p)
            {
                s-=pieces.back();
                pieces.pop();
            }
            if(pieces.size() < minl)
            {
                //cout<<pieces.size()<<" ";
                minl = pieces.size();
            }
        }
    }
    cout<<minl;
    return 0;
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:12:5: error: 'f' was not declared in this scope
   12 |     f>>n>>p;
      |     ^
Exited with error status 1