RE 求救!!!
查看原帖
RE 求救!!!
1355403
HarrycodingH楼主2024/8/20 19:40
#include <bits/stdc++.h>
using namespace std;
int cost,dp[100001],n;
int main(){
	cin >> n;
	for (int i=1;i<=n;i++){
		cost=100000000;
		if(i-1>=0) cost=min(dp[i-1]+1,cost);
		if(i-5>=0) cost=min(dp[i-5]+1,cost);
		if(i-11>=0) cost=min(dp[i-11]+1,cost);
		dp[i]=cost;
	}
	cout << dp[n];
}
2024/8/20 19:40
加载中...