#include <stdio.h>
int main() {
int time[3] = {2,3,5};
int n = 3;
int m = 10;
int low,high;
low = 0;
high = 5 * m;
int result = 0;
while (low <= high) {
int sum = 0;
int mid = (low + high) / 2;
for (int i = 0;i < n;i++) {
sum += mid / time[i];
}
if (sum >= m) {
result = mid;
high = mid - 1;
}else{
low = mid + 1;
}
}
printf("%d", result);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: