#include using namespace std; const int N = 1000010; // 90分,数组不能再大了~ int st[N]; int cnt; // 已经取出的个数 int day; // 第n个苹果是第day天被取走的 int all; // 一共需要多少天 int main() { // freopen("apple.in", "r", stdin); // freopen("apple.out", "w", stdout); int n; cin >> n; while (true) { // 模拟每一天 all++; int c = 0; for (int i = 1; i <= n; i++) { if (st[i]) continue; c++; if (c % 3 == 1) { // 找规律,1,4,7,10...出列 st[i] = 1; cnt++; // 又出队一个 if (i == n) day = all; // 记录n是哪天出队的 } } if (cnt == n) break; // 如果出队数量达标就完事 } // 输出一共需要多少天,取出第n号在第几天 cout << all << " " << day << endl; return 0; }