20分 求援!!!
查看原帖
20分 求援!!!
751572
Jason_LiDongJin楼主2022/10/24 20:05
#include<bits/stdc++.h>
using namespace std;
const int ans[3]={1,2,3};
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long x,k;
	cin>>x>>k;
	while(x!=1)
	{
		x++;
		if(x%3==0)x/=3;
		k--;
		if(k==0)break;
	}
	if(k==0)cout<<x<<"\n";
	else cout<<ans[k%3+1]<<"\n";
	return 0;
}
2022/10/24 20:05
加载中...