50分求助!为啥只对了1,2,5,8,10
查看原帖
50分求助!为啥只对了1,2,5,8,10
917683
rnf5114楼主2023/2/18 19:43
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long x,k;
    cin>>x>>k;
    for(int i=1;i<=k;i++){
        x++;
        if(x%3==0){
        	x/=3;
		}
        if(x==1){
            if(k%2==1){
                cout<<2;
                return 0;
            }
            else{
                cout<<1;
                return 0;
            }
        }
    }
    cout<<x;
    return 0;
}
2023/2/18 19:43
加载中...