AC

我是小学生  •  1天前


include <bits/stdc++.h>

using namespace std; int n, x; int ans, cnt;

int main() {

scanf("%d", &n);
x = n;

while (x) { //还剩了苹果就一直取
	cnt++;
	x -= (x + 2) / 3; //这个相当于向上取整
}
printf("%d ", cnt);

while (1) {
	ans++;
	if (n % 3 == 1)
		break;
	n -= (n + 2) / 3;
}
printf("%d", ans);
return 0;

}


评论:

请先登录,才能进行评论