蓝桥杯 能量石 知识点:贪心

76 阅读1分钟

6.能量石 - 蓝桥云课 (lanqiao.cn) image.png

#include<bits/stdc++.h>
using namespace std;
int ans;
int main()
{
	int n; cin >> n;
	
	int temp1 = n / 6;

	int temp2 = n % 6;






     ans = ans+(temp1*3); //有多少个6就有多少个3天
     
     
	if (temp2 >= 1 && temp2 <= 2)ans+=1;    //剩1就只能再用1天

	else if (temp2 >= 3)ans+=2;           //剩的能量石大于3个,还能用两天

	cout << ans << endl;
return 0;
}