JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java 新手區 » 演算法  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
笑傲漿糊





發文: 18
積分: 0
於 2006-01-03 17:50 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
最近一直想要去上課說
但是總是舉棋不定
先看看嚕
也許自學也是不錯的主意


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
macs





發文: 1
積分: 0
於 2006-02-02 23:13 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
哇!!
蠻讚的!!
對小弟! 新手而言幫助真大!!
感謝您!!


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
tokugawa





發文: 20
積分: 0
於 2006-02-05 13:30 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
前幾天才去買java學習筆記
現在又發現好東西了
感謝良大大


reply to postreply to post
新手問題比較多>"<
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
twelve





發文: 14
積分: 0
於 2006-03-10 15:45 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
大哥们,有简体中文的没,我机子上没 繁体中文的 解码软件,打不开啊
非常想看下,希望对我这个新手帮助多多。。。


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
baicaoyuan





發文: 2
積分: 0
於 2006-03-25 20:38 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Thank you

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
hitoboy





發文: 6
積分: 0
於 2006-03-26 17:09 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
下載了...非常感謝您無私的愛......
呵呵


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
sicaca_james





發文: 1
積分: 0
於 2006-03-26 22:18 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
感謝良葛格的貢獻,讓自已又重新學習了資料結構,這個煩人的東西…
不過,有個問題讓我百思不得其解,如果網上有先進可以提點一二的話,本人感激不盡…

問題:在良葛格所提供的常見程式題目中,有一八個皇后的題目,自已很有興趣,想要玩看看,但在其中程式碼中(c的部份),為什麼會宣告二個陣列rup及lup,這二個陣列雖然有相關備註,但是自已在用step by step的方法下,仍然不懂該二個陣列中的意義為何???? 為什麼要設成2*N+1的長度????

以下為從良葛格所提供的常見程式題目中,八個皇后問題的c程式碼。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdlib.h>
#define N 8
int column[N+1];// 同欄是否有皇后,1表示有
int rup[2*N+1]; // 右上至左下是否有皇后
int lup[2*N+1]; // 左上至右下是否有皇后
int queen[N+1] = {0};
int num; // 解答編號
void backtrack(int); // 遞迴求解
int main(void)
   {
   int i;
   num = 0;
   for(i = 1; i <= N; i++)   column[i] = 1;
   for(i = 1; i <= 2*N; i++)   rup[i] = lup[i] = 1;
   backtrack(1);
   return 0;
   }
 
void showAnswer()
   {
   int x, y;
   printf("\nanswer: %d\n", ++num);
 
   for(y = 1; y <= N; y++)
      {
      for(x = 1; x <= N; x++)
         {
         if(queen[y] == x)
           printf(" Q");
         else
           printf(" .");
         }
      printf("\n");
      }
   }
 
void backtrack(int i)
   {
   int j;
   if(i > N)   showAnswer();
   else
      {
      for(j = 1; j <= N; j++)
         {
         if(column[j] == 1 && rup[i+j] == 1 && lup[i-j+N] == 1)
           {
           queen[i] = j;                 // 設定為佔用
           column[j] = rup[i+j] = lup[i-j+N] = 0;
           backtrack(i+1);
           column[j] = rup[i+j] = lup[i-j+N] = 1;
           }
         }
      }
   }


sicaca_james edited on 2006-03-27 09:41
reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
lingtsung





發文: 6
積分: 0
於 2006-03-26 23:51 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
感謝您的分享~很有用而且也是學習上的好幫手~ 謝謝~

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
longnini1977





發文: 3
積分: 0
於 2006-04-03 10:27 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
目前就讀國內某科大的資訊管理系二技...
因為之前五專讀的是水產科(超冷的科系)...
現在讀起資管有點不大習慣..
尤其是Java這方面..
真的很慘..
謝謝caterpillar 版主這麼關愛我們這些Java新手..
謝謝~


reply to postreply to post
作者 Re:「常見{式題目」打包檔 [Re:caterpillar]
shadowxgm





發文: 12
積分: 0
於 2006-06-03 23:05 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
caterpillar wrote:
把chm檔中的題目全部實作一遍吧。。。。。Smile這樣就會是您的了。。。。


说得好!


reply to postreply to post
java新手~请多指教~
Java is everthing!
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
CC3001





發文: 4
積分: 0
於 2006-06-24 22:43 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
對新手來說真是太棒了,感謝!!

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
lingtsung





發文: 6
積分: 0
於 2006-06-25 18:48 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
雖然我縣在看不懂相信以後可以看董
還是要謝謝你Cool


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
gegeyy





發文: 2
積分: 0
於 2006-07-03 12:09 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
謝謝你的分享~~
我是剛入門新手~~
剛來這板~~~有如發現
新天地~~一直想沉浸在裡面說
很感謝有大大有如此心思說
讓我們真的有好的學習環境^^


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
ecnufudan





發文: 8
積分: 0
於 2006-08-15 02:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
新手吖...不懂中...感激滴說!

reply to postreply to post
@_@快樂是一天,痛苦是一天,不如開開心心過一天.@_@
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
國士_無雙





發文: 2
積分: 0
於 2006-08-30 11:05 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
感謝良葛格大大分享

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
doris2722





發文: 5
積分: 0
於 2006-10-12 11:00 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list


reply to postreply to post
All Roads Lead To Rome~~~
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
leo3330226





發文: 2
積分: 0
於 2006-10-15 19:54 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
最近學校的學java,找了相關的網站,好像只有大大整理的最經典!
感謝你無私的奉獻!


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
drdr1130





發文: 3
積分: 0
於 2006-10-24 15:02 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
真是太感謝了
這對初學者而言真的很實用
弟收下了(第一天學java的人^^)


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
520rocky





發文: 1
積分: 0
於 2006-10-31 22:10 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
多谢大大 我会努力学习的

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
落日醉心





發文: 9
積分: 0
於 2006-11-04 22:44 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
因為今年就讀資訊管理系...想說可以好好學習一番
沒想到碰上JAVA的課程...(以前根本沒學過)
現在讀起來相當吃力..
感謝版大如此用心的分享....
謝謝~


reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
broodwarfish

卡卡哦



發文: 17
積分: 0
於 2006-12-14 09:22 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
強啊....向樓主學習中.....

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
2007java





發文: 3
積分: 0
於 2007-01-25 16:02 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
顶!谢谢!Thumbs upThumbs up

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
fonttw





發文: 1
積分: 0
於 2007-01-27 12:05 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問一下 為什麼不能下載來看了

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
shenjianshan





發文: 1
積分: 0
於 2007-01-29 20:39 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我怎么下载不了啊,是不是网址变了,能不能给小弟一个新的网址下载啊?

reply to postreply to post
作者 Re:良葛格筆記系列「常見程式題目」 [Re:caterpillar]
ydstcyes





發文: 2
積分: 0
於 2007-02-06 22:30 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
看看,研究一下

reply to postreply to post
go to first page go to previous page  1   2   3   4   5  go to next page go to last page
» JWorld@TW »  Java 新手區 » 演算法

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8