算法1
你就看吧,看出来,你就赢了,就是在$(3^n)/2$以内每次,各成一个区间
C++ 代码
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//1 1 2 2 3 2 4 2 5 3 6 3 7 3 8 3 9 3 10 3 13 (1 2 4 7)
//1 1~1 2 2~4(1+4-1) 3 5~12(4+9-1)
map<ll,ll> mp;
ll _pow(int x, int k){
ll res = 1;
for(int i = 1; i <= k; ++ i) res = res * x;
return res;
}
void init(ll k){
for(int i = 1; i <= 1000; ++ i){
mp[i] = _pow(3, i) / 2;
}
for(const auto &p : mp){
if(p.second < k) continue;
else{
cout << p.first;
return;
}
}
}
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll k; cin >> k;
init(k);
return 0;
}