Knight Moves hdu1372 bfs

/*一開始題目沒有看懂,原來是象棋中的跳馬問題你不是喜歡下棋的嗎?可是為何。。。糾結這是我第一自己獨立寫的bfs, 在通過調試,終於改了自己犯的低級的毛病(標記為@的地方)*/#include<iostream>//2374758 2010-04-23 14:41:15 Accepted 1372 46MS 292K 1189 B C++ 悔惜晟 #include<queue>#include<cstdio>using namespace std;int

Can you find it? hdu2141 二分尋找

/*   這個題目分在搜尋的地方,最近一直在寫bfs dfs, 腦子中看見題目就感覺是搜,   其實這個題目很簡單的,排序 + 二分尋找就OK了   二分一直沒有寫過,都是在書本上看理論知識,理論聯絡實際,   這才是最重要的*/#include<iostream>//2395029 2010-04-28 18:42:18 Accepted 2141 390MS 1276K 1076 B C++ 悔惜晟

Anagrams by Stack dfs

/*很明顯的深搜的題目,而且很用到了棧的知識,不錯的題目,  感覺還不是很懂,有點瓶緊的感覺,應該是對棧不是很熟悉的緣故吧,  感覺好像做過的dfs的題目好像都有特定的格式一樣的,  好好加油  */#include<iostream>#include<stack>using namespace std;char a[1000];char b[1000];bool hash[2000];int lena, lenb;stack<char> s;void

A計劃 hdu 2102 終於AC,why?? bfs

/* 這是看到這個題目第一次寫的代碼,但是 標記為@的地方沒有考慮,一直測試資料都過不了,怎麼回事? 為何要犯那麼糾結的錯誤呢??還有要考慮兩層都是#的情況的,其實一看題目我就想到的,我以為不要考慮的 */ #include<iostream> //2399013 2010-04-29 16:50:05 Accepted 2102 0MS 296K 2418 B C++ 悔惜晟 #include<queue>#include<cstring>#include&

暢通工程 hdu1863

http://acm.hdu.edu.cn/showproblem.php?pid=1863 #include<iostream>//又是最小產生樹的問題#include<algorithm>#include<cstdio>using namespace std;int s[4951];  struct stu {  int x;  int y;  int dis; }df[4951]; int cmp(stu a, stu b) {  return

hdu 1431 素數迴文

/*本題給的n的資料很大,但是n > N 的時候的數都是不成立數論真的要好好的去學習*/#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;const int N = 10000000;bool hash[N];int path[1000000];int len;inline void

Phone List 1671hdu

/* 這是很早做錯的題目,今天看了許建峰買來的書,試了下書上的STL,AC了 很強大的STL,我決定今晚全部學完,加油! 以前做這個題目的時候題目的意思讀錯的,糾結啊! 尋找一個串是否是另個的首碼?*/ #include<iostream>//2453667 2010-05-14 19:42:26 Accepted 1671 328MS 748K 577 B C++ 悔惜晟

Oil Deposits hdu1241 dfs

#include//2367513 2010-04-21 20:22:34 Accepted 1241 15MS 340K 992 B C++ 悔惜晟using namespace std;char map[105][105];int dir[8][2] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1} };int m, n; //一開始方向寫錯了,真是糾結的。void dfs(int x,

hdu 1141 Factstone Benchmark

//很簡單的題,就是n!<2^bit只是想提醒自己,很大數之間的比較有時候只要選擇對數就好了。求出最大的n //一開始題目讀不懂,baidu了才知道題目的意思,題目很簡單,只是題目的意思很難讀懂//2268208 2010-03-30 17:32:13 Accepted 1141 281MS 312K 285 B C++ 悔惜晟  #include<iostream>#include<cmath>using namespace std;int

進位轉換 2031 直接調用stack

//第一次調用棧,突然發現這是一個好東西 #include<iostream>#include<cstdio>#include<stack>using namespace std;//int num[100001];int main(){ int n, r; while(cin>>n>>r) {  if(n < 0)  {   printf("-");   n = -n;  }  stack <int>  q;  //

hdu 2377 Bus Pass(學了下鄰接表)

/*逼著自己去寫鄰接表,xwc給我講過大致如何構造,聽其實還是簡單的。可是寫起來稍微有點困難的光是建表就很糾結的,指標數組 和 數組 總是不能區別開來,最初很痛苦寫好的,編譯沒有通過,把這兩個東西混起來,對於指標就是有一種莫名的不知道。很早xwc就鼓勵我去寫了,但是一直害怕麻煩就不敢嘗試,這是一個不好的毛病,為了不能讓cdd

Tempter of the Bone hdu1010

/*這是上學期老師講的題目,開始聽的時候感覺有點懵懂,也就不敢嘗試的去寫,  後來發現搜尋相當重要,特別是在這段時間以來我發現搜尋不會就是菜鳥,  從這裡開始我要認真地學習搜尋 */#include<iostream>//2359309 2010-04-19 19:20:14 Accepted 1010 62MS 284K 1405 B C++ 悔惜晟 #include<cstdio> //不知道他們0秒的是怎麼實現的??using namespace std;char

How Many Tables hdu1213(並)

http://acm.hdu.edu.cn/showproblem.php?pid=1213#include<iostream>//很簡單的並查集 #include<cstdio>int s[1002];//bool ss[1002];  int find(int a) {  int r = a;  while(r != s[r])   r = s[r];  return r; } void merge(int a, int b) {  if(a > b)   s[

Asteroids! hdu 1240 終於AC

/*很水的bfs,一開始bfs不會,用dfs錯了好多次,應該是演算法有問題吧,我覺得這個題目用dfs應該可以的*/#include<iostream>//2389356 2010-04-27 11:23:31 Accepted 1240 0MS 308K 1495 B C++ 悔惜晟 #include<queue>#include<cstring>#include<cmath>using namespace std;char map[12][12]

Prime Ring Problem hdu 1016 dfs

#include<iostream>//2365548 2010-04-21 14:16:05 Accepted 1016 500MS 300K 1160 B C++ 悔惜晟 #include<cstring>using namespace std;bool hash[40];bool hash1[25];int num[25];int n;void dfs(int count){ int j; if(count == n) {  if(hash[ num[1] +

Chinese Rings 2842 hdu (http://qzc.zgz.cn/Y-jiulianhuan3.htm 很流氓的網址)

/*http://qzc.zgz.cn/Y-jiulianhuan3.htm原來這是一個遊戲記從始點到前k個環在上用f(k)步,考慮怎麼上這前k個環呢?可以先上前k-1個環,用f(k-1)步,再下前k-2個環,用f(k-2)步。此時僅有第k-1個環在上,可以進行動作Q上k號環,用1步,然後再上前k-2個環,用f(k-2)步。f(k)就是以上各個動作所需步數的和,f(k)=f(k-1)+f(k-2)+1+f(k-2) =f(k-1)+2f(k-2)+1即 f(k) =f(k-1)+2f(k-2

A strange lift hdu 1548

/*    終於AC了,很簡單的bfs,我居然卡了那麼久,結果居然是我題目的意思看錯了,   there is a number Ki(0 <= Ki <= N) on every floor 這句話沒有認真讀,   我以為是up down 是按題目給我們的順序按的,結果第一次超記憶體,後來用hash標記,wrong。。。   後來終於看見那句要命的話了。讀懂題目方能開始做題目,切記!! */#include<iostream>//2393959 2010-04-28 1

IP的計算 hdu2206

http://acm.hdu.edu.cn/showproblem.php?pid=2206//在wrong 10次後終於AC//為何簡單的題目要考慮這麼久? #include<iostream>//2265653 2010-03-29 21:34:12 Accepted 2206 0MS 228K 1452 B C++ 悔惜晟 #include<string>#include<cstdio>using namespace std;int

Train Problem I hdu 1022 棧

http://acm.hdu.edu.cn/showproblem.php?pid=1022//學了資料結構,一點也不會用,好鬱悶的;//這是棧很基礎的內容,參考了別人的,終於寫起來有點感覺// 3 123 123   123 213  這兩種情況是可以的#include<iostream>//2275912 2010-03-31 22:18:55 Accepted 1022 0MS 352K 831 B C++ 悔惜晟 #include<cstdio>using

Red and Black hdu 1312

/* 1y 不錯的,昨天聽鐘超分析了dfs bdf 感覺好像有點懂起來了   這個題目的意思很簡單,一開始我想深搜的時候怕逾時,但是還是覺得可以,就敲代碼了,   可是遇到問題了,這個題目的行列輸入跟平時的不一樣,在這裡的就用了,傳統的習慣,糾結ing   跟糾結的@的地方用了map[si][sj] = false 結果答案少了1,後來進行調試,也是鐘超哪裡學來的   於是馬上發現錯誤了 */#include<iostream>//2374171 2010-04-23 12:59:2

總頁數: 61357 1 .... 17848 17849 17850 17851 17852 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.