其他分享
首页 > 其他分享> > 雇佣兵

雇佣兵

作者:互联网

雇佣兵

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	//M=体力 N = 战斗力 X=能量元素 
	int M,N,X;
	int reduce = 0;
	scanf("%d %d %d",&M,&N,&X);
	while(X>0)
	{
		if(M % N == 0)	
			reduce = M/N;
		else
			reduce = M/N+1;
		if (reduce > X)
		{
			break;
		}
		N = N + M/N ;     //N天加1点战斗力
		X = X - reduce ;
	}
	printf("%d",N);

	return 0; 
 } 

标签:战斗力,int,reduce,雇佣兵,体力值,战斗
来源: https://blog.csdn.net/qq_39901722/article/details/104884693