You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
562 B
18 lines
562 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int n, all, day;
|
|
|
|
int main() {
|
|
cin >> n;
|
|
while (n) { // 剩余苹果数量
|
|
all++; // 新的一天
|
|
if (day == 0 && n % 3 == 1) day = all; // 判断编号n的苹果第几天被取走
|
|
n -= ceil(1.0 * n / 3);
|
|
// 上取整公式
|
|
// n = n - (n + 2) / 3; // 剩余苹果数
|
|
}
|
|
// 输出总天数 和 第n 个苹果第几天被取走
|
|
cout << all << " " << day << endl;
|
|
return 0;
|
|
} |