三个wa,求救
查看原帖
三个wa,求救
147400
corgilld楼主2023/11/5 23:31
#include <iostream>
using namespace std;

int main() {
	long long n, k, tp;
	int s = 0;
	bool flag = 0;
	cin >> n;
	while (n > 3) {
		k = n;
		n -= (n + 2) / 3;
		s++;
		if (((k + 2) % 3 == 0) && (!flag)) {
			flag = 1;
			tp = s;
		}
	}
	s += 3;
	cout << s << " ";
	if (!flag)
		cout << s;
	else
		cout << tp;
}
2023/11/5 23:31
加载中...