C++,AC了,但是有一点小疑问
查看原帖
C++,AC了,但是有一点小疑问
542875
MY_gg楼主2022/10/23 18:24

这是AC代码:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	unsigned long long x,k;
	cin>>x>>k;
	while(k--)
	{
		x++;
		if(x%3==0)
		{
			x/=3;
		}
		if(x==1)
		{
			if(k%2==1)
			{
				cout<<2;
				return 0;
			}
			else
			{
				cout<<1;
				return 0;
			}
		}
		/*
      x++;
		if(x%3==0)
		{
			x/=3;
		}
        */但是放在这里就是20分,请问这是为什么?
	}
	cout<<x;
	return 0;
}

谢谢~~~

2022/10/23 18:24
加载中...