### a227: 三龍杯 -> 河內之塔 <!-- Put the link to this slide here so people can follow --> <!-- slide: https://hackmd.io/@sharonshau/HJsovgI2L --> --- --- ###### 複製以下程式碼填空(…的地方記得要改) ```typescript #include<iostream> using namespace std; //有n個環,從source移到target,中間的temp為輔助柱 void hanoi(int n, char source, char temp, char target) { if(n==1) cout<<"Move ring "<<n<<" from "<<source<<" to "<<target<<"\n" ; else { hanoi(n-1,source,target,temp) ; cout<<... hanoi(...) ; } } int n; int main() { while(cin>>n) { hanoi(...); cout<<"\n" ; } return 0; } ```
{"metaMigratedAt":"2023-06-15T09:07:40.765Z","metaMigratedFrom":"YAML","title":"a227.三龍杯->河內之塔","breaks":true,"description":"View the slide with \"Slide Mode\".","slideOptions":"{\"transition\":\"slide\",\"parallaxBackgroundImage\":\"http://drive.google.com/uc?id=1Wn56DhI3vAPRHaggAkZq50KaDajQQPG4\"}","contributors":"[{\"id\":\"43a70fac-152f-4429-8bb9-6f9271c4ae8e\",\"add\":935,\"del\":2406}]"}
    270 views