#include <bits/stdc++.h>
// #include "ricehub.h"
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
int ans = 0;
for(int i=0 ; i<R ; i++)
{
long long temp = B;
int now = 1, j = i+1;
while(j < R)
{
if(temp < X[j] - X[i]) break ;
temp -= X[j] - X[i];
j++;
now++;
}
ans = max(ans, now);
}
return ans;
}
int arr[] = {1, 2, 10, 12, 14};
int main()
{
cout << besthub(5, 20, arr, 6ll) << endl;
}
Compilation message
/tmp/cc105g2Q.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccf07Vs8.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status