忘记把调试程序删掉且只做出这一题
#include<bits/stdc++.h>
using namespace std;
int x,sum=0,x1,ans=0,f=1;
int main(){
freopen("apple.in","r",stdin);
freopen("apple.out","w",stdout);
cin>>x;
x1=x;
while(x){
if(x%3==0){
x-=x/3;
}
else{
x-=(x/3+1);
}
sum++;
}
while(x1>0){
if((x1-1)%3==0&&x1!=1){
ans++;
break;
}
else{
if(x1%3==0){
x1-=x1/3;
}
else x1-=x1/3+1;
ans++;
cout<<"x1:"<<x1<<endl;
}
}
cout<<sum<<" "<<ans;
}