2

Gooooogle  •  4个月前


#include <stdio.h>

int main() {
	int n, c = 0, ans = 0;
	scanf("%d", &n);
	while (n > 0) {
		c++;
		if (n % 3 == 1 && ans == 0) {
			ans = c;

		}
		int s = n * 1.0 / 3 + 0.99999;
		n = n - s;

	}
	printf("%d %d", c, ans);
}

评论:

请先登录,才能进行评论