93952024-02-21 12:35:40KristófLeghosszabb nyaralás (75 pont)cpp17Compilation error
#include <iostream>
#include <vector>
struct penz{
    int budget;
    int nap;
} typedef;

using namespace std;

int main()
{
    int n , p;
    cin>>n>>p;
    int num;
    vector <penz> napok;
    for(int i=0;i<n;i++)
    {
        cin>>num;
        napok.push_back({num,1});
        for(int j=0;j<napok.size()-1;j++)
        {
            if(napok[j].budget<p+1)
                {
                    napok[j].budget+=num;
                    napok[j].nap+=1;
                }
        }
    }
    int max=INT_MIN;
    for(int i=0;i<n;i++)
        {
            if(napok[i].nap-1>max)
                {
                max=napok[i].nap-1;
                }
        }
    cout<<max;



    return 0;
}
Compilation error
exit status 1
main.cpp:6:3: warning: 'typedef' was ignored in this declaration
    6 | } typedef;
      |   ^~~~~~~
main.cpp: In function 'int main()':
main.cpp:29:13: error: 'INT_MIN' was not declared in this scope
   29 |     int max=INT_MIN;
      |             ^~~~~~~
main.cpp:3:1: note: 'INT_MIN' is defined in header '<climits>'; did you forget to '#include <climits>'?
    2 | #include <vector>
  +++ |+#include <climits>
    3 | struct penz{
Exited with error status 1