858 | 2022-01-21 11:48:11 | zsebi | Leggyorsabb pénzkeresés (50) | cpp11 | Compilation error |
#include <iostream>
#include <vector>
#define ll long long
using namespace std;
ll i,p,n,j,db,s,mini;
vector <ll> x;
int main()
{
cin>>n>>p;
x.resize(n+1);
for(i=1;i<=n;++i)
{
cin>>x[i];
}
mini=INT_MAX;
i=1;
while(i<=n)
{
db=0;
s=0;
for(j=i;j<=n;++j)
{
s+=x[j];
db++;
if(s>=p && db<mini)
{
mini=db;
break;
}
}
++i;
}
cout<<mini;
return 0;
}
exit status 1main.cpp: In function ‘int main()’:
main.cpp:18:10: error: ‘INT_MAX’ was not declared in this scope
18 | mini=INT_MAX;
| ^~~~~~~
main.cpp:3:1: note: ‘INT_MAX’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’?
2 | #include <vector>
+++ |+#include <climits>
3 |
Exited with error status 1