8 条题解

  • 3
    @ 2022-3-26 11:21:52
    #include <queue>
    #include <math.h>
    #include <stack>
    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <iomanip>
    #include <string.h>
    #include <algorithm>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    void f(int n , char A , char B , char C)
    {
    	if(n == 0)
    		return ;
    	f( n-1 , A , C , B);
    	cout << "Move " << A <<" to "<<C<<endl;
    	f(n-1 , B , A,C);
    
    }
    int main()
    {
    	int n ;
    	cin >> n;
    	cout << pow(2,n) - 1 << endl;
    	f(n,'A' , 'B'  , 'C');
    	return 0;
    }
    

    信息

    ID
    1234
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    386
    已通过
    153
    上传者