这里要特判一下能量不够的时候
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
char arr[10010];
int main(){
int M,N,X;
scanf("%d%d%d",&M,&N,&X);//M是体力最大值
int n = N;
int consum=0;
while(consum<=X){
consum++;
if(consum*N>=M){
X -= consum;
consum = 0;
if(X<0) break;
N += (M / N);
}
}
printf("%d",N);
return 0;
}