7487 | 2024-01-09 10:32:01 | fftekla | Sípálya (55 pont) | cpp17 | Compilation error |
#include <iostream>
#include <vector>
using namespace std;
int i,j,K,N,koltseg,magassag,mini=INT_MAX;
vector <int>v;
int main()
{
cin>>N;
cout<<" ";
cin>>K;
v.resize(N+1);
for (i=1;i<=N;++i)
cin>>v[i];
for (i=1;i<=N-K+1;++i)
{
koltseg=0;
magassag=v[i+K-1];
for(j=i+K-1;j>i;--j)
if(v[j-1]<=magassag)
{
koltseg+=magassag-v[j-1]+1;
magassag++;
}
else
{
koltseg+=(v[j-1]-magassag-1)*(i+K-j);
magassag=v[j-1];
}
if(koltseg<mini) mini=koltseg;
}
cout<<mini;
}
exit status 1
main.cpp:5:35: error: 'INT_MAX' was not declared in this scope
5 | int i,j,K,N,koltseg,magassag,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 | using namespace std;
Exited with error status 1