• <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

            ????????????上網時,偶然發現有人在變漢諾塔程序,于是就由C語言編了一個小小的程序。大家有興趣可以see see !!
            ????????? 我的漢諾塔程序采用的是遞歸調用的思想。
            ? 漢諾問題的遞歸思想就是三步走:
            原來都在A柱,輔助B柱,目標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)編輯 收藏

            僅列出標題  
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            導航

            統計

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            最新評論

            • 1.?re: null
            • 能不能使用標題呢?讓大家一目了然
            • --flyingxu
            久久精品国内一区二区三区| 久久人人爽人人爽AV片| 婷婷久久五月天| 国内高清久久久久久| 久久精品aⅴ无码中文字字幕不卡| 色欲综合久久中文字幕网| 成人国内精品久久久久影院VR| 久久综合一区二区无码| 久久福利资源国产精品999| 久久99精品久久久久久齐齐| 久久久久人妻一区精品色 | 久久精品a亚洲国产v高清不卡 | 久久精品成人欧美大片| 久久亚洲欧美国产精品| 一本大道久久东京热无码AV| 一级做a爰片久久毛片16| 人妻丰满AV无码久久不卡| 亚洲午夜精品久久久久久人妖| 思思久久99热只有频精品66| 国产精品九九久久免费视频| 国产婷婷成人久久Av免费高清 | 伊人久久大香线蕉综合5g| 久久精品免费观看| 精品久久久无码人妻中文字幕| 午夜精品久久久久久影视777| 国产农村妇女毛片精品久久| 久久久久99精品成人片欧美| 久久AV无码精品人妻糸列| 亚洲欧洲精品成人久久奇米网| 大蕉久久伊人中文字幕| 欧美精品一本久久男人的天堂| 国产精品久久久久久久| 久久综合中文字幕| 99久久99这里只有免费的精品| 久久国产精品成人影院| 日本久久久久亚洲中字幕| 精品伊人久久大线蕉色首页| 久久亚洲AV成人无码软件| 久久天天婷婷五月俺也去| 中文成人无码精品久久久不卡| 久久只有这精品99|