• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            yanzi

            2006年5月19日

            null

            ????????????上網(wǎng)時,偶然發(fā)現(xiàn)有人在變漢諾塔程序,于是就由C語言編了一個小小的程序。大家有興趣可以see see !!
            ????????? 我的漢諾塔程序采用的是遞歸調(diào)用的思想。
            ? 漢諾問題的遞歸思想就是三步走:
            原來都在A柱,輔助B柱,目標(biāo)C
            1)想辦法把A柱上的除最底下一個以外的盤借助C柱全部移到 B柱,
            2)把最后剩下的一個盤從A移到C
            3 )把 B 柱上的盤想辦法全部移到 C 柱。
            ?1?#include"stdio.h"
            ?2?void?movedisk(int?n,char?fromneedle,char?toneedle,char?usingneedle);?int?i=0;
            ?3?main()
            ?4?{int?m;
            ?5??int?stop=1;
            ?6??printf("??????????????**********************************\n");
            ?7??printf("??????????????*???Welcome?to?my?program!!!^-^??*\n");
            ?8??printf("??????????????**********************************\n");
            ?9??printf("This?is?a?Game?called?Hanoi,you?can?follow?the?steps?below?to?begin!!!\n");
            10???while(stop){i=0;
            11???????????????printf("Please?input?the?number?of?the?disk:");
            12???????????????scanf("%d",&m);
            13???????????????movedisk(m,'a','c','b');
            14???????????????printf("\nthe?fewest?steps?you?have?to?go?is?%d.\n",i);
            15???????????????printf("\nif?you?want?to?stop,input:0?,else?input:1\nInput:");
            16???????????????scanf("%d",&stop);
            17??????????????}
            18????getch();
            19??}
            20?
            21??void?movedisk(int?n,char?fromneedle,char?toneedle,char?usingneedle)
            22?{
            23??if(n==1)
            24?????printf("[%d]??%c--->%c\t",++i,fromneedle,toneedle);
            25???else?if(n>1)
            26??????{movedisk(n-1,fromneedle,usingneedle,toneedle);
            27???????printf("[%d]??%c--->%c\t",++i,fromneedle,toneedle);
            28???????movedisk(n-1,usingneedle,toneedle,fromneedle);
            29???????}
            30?
            31???}

            posted @ 2006-05-19 20:49 yanzi0518 閱讀(541) | 評論 (1)編輯 收藏

            僅列出標(biāo)題  
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            最新評論

            • 1.?re: null
            • 能不能使用標(biāo)題呢?讓大家一目了然
            • --flyingxu
            97精品国产97久久久久久免费| 精品久久久无码21p发布| 久久久久久久综合日本亚洲| 久久久久人妻精品一区三寸蜜桃| 久久精品亚洲福利| 色综合久久无码中文字幕| 18岁日韩内射颜射午夜久久成人| 要久久爱在线免费观看| 久久99精品国产99久久| 97香蕉久久夜色精品国产| 国产精品久久自在自线观看| 欧美激情精品久久久久久久| 久久久久99精品成人片直播| 伊人精品久久久久7777| 久久精品国产精品青草app| 精品无码久久久久国产动漫3d| 久久综合九色综合97_久久久| 少妇高潮惨叫久久久久久 | 中文精品久久久久人妻| 99久久99这里只有免费费精品 | 99精品伊人久久久大香线蕉| 久久精品人妻中文系列| 久久国产视屏| 久久e热在这里只有国产中文精品99 | 久久涩综合| 久久久久久狠狠丁香| 久久99精品久久久久久久久久| 狠狠精品久久久无码中文字幕 | 久久久这里只有精品加勒比| 精品人妻伦九区久久AAA片69| 美女写真久久影院| 久久亚洲国产中v天仙www | 久久婷婷五月综合国产尤物app| 性做久久久久久免费观看| 久久免费大片| 99久久国产亚洲综合精品| 一本一道久久a久久精品综合| 亚洲欧美国产日韩综合久久| 色偷偷91久久综合噜噜噜噜| 伊人久久亚洲综合影院| 亚洲乱码精品久久久久.. |