#include <bits/stdc++.h> using namespace std; int main(){ int n,cnt=0,end; bool f=true; cin >> n; while(n!=0){ cnt++; if(n%3==1&&f){ end=cnt; f=!f; } n-=ceil(n*1.0/3); } cout << cnt << " " << end; return 0; }
这代码比题解还好用!!!