1 / 15

情報科学&情報科学演習

2011 年度. 情報科学&情報科学演習. ~ 定番プログラム(2) ~. ハノイの塔(ルール). 一度に1枚の円盤しか動かせない 小さい円盤の上に大きい円盤を重ねてはならない. ハノイの塔(直接的解法). A. 偶数の円盤. 奇数の円盤. B. C. ハノイの塔(直接的解法). A. 偶数の円盤. 奇数の円盤. B. C. ハノイの塔(直接的解法). A. 偶数の円盤. 奇数の円盤. B. C. ハノイの塔(直接的解法). A. 偶数の円盤. 奇数の円盤. B. C. ハノイの塔(直接的解法). A. 偶数の円盤.

tan
Download Presentation

情報科学&情報科学演習

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 2011年度 情報科学&情報科学演習 ~ 定番プログラム(2)~

  2. ハノイの塔(ルール) • 一度に1枚の円盤しか動かせない • 小さい円盤の上に大きい円盤を重ねてはならない

  3. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  4. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  5. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  6. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  7. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  8. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  9. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  10. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  11. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  12. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  13. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  14. ハノイの塔(直接的解法) A 偶数の円盤 奇数の円盤 B C

  15. 最大公約数を求めるプログラム 練習:変数 x, y, tをトレースしなさい 5: int x = 1234, y = 56, t; 6: 7: printf("gcd(%d,%d)=", x, y); 8: while (y != 0) { 9: t = x; 10: x = y; 11: y = t % x; 12: } 13: printf("%d\n", x); レポート4の問4 (report0401.c)

More Related