hdu 1272 並查集

/* hdu 1272 簡單並查集 只要查有沒有迴路就夠了 只要有共同根節點 就必然有迴路*/#include <cstdio>#include <algorithm>#define maxn 100005using namespace std;int father[maxn];int vis[maxn];//int map[maxn][maxn];int find(int x){ if(father[x]!=x) return

9.2.1(矩形嵌套_最長子序列方法)

原來就是初始化的時候要把所有的d都初始化為1;因為每一個點的,初始化結果就是1;開始的時候沒有意識到,,,#include <stdio.h>#include <string.h>#include <iostream>#include <string>#include <algorithm>#define max(a, b) (a) > (b) ? (a) : (b)using namespace std;const int

商品管理系統課程設計

1、系統應具備的功能:(1)進貨員對商品基本資料進行輸入、刪除、修改和查詢(2)銷售人員對商品的基本資料進行查詢和統計(3)並可以對庫存資訊進行查詢和修改    (4)顧客購買商品2、要求: (1)介面劃分清晰,功能全面(2)操作方便。(3)資料結構選擇合理,演算法正確。   儲存結構  1、           使用者儲存採用sqlite資料庫,提高資料庫的安全性、便利性。2、           對商品的一系列屬性用結構體表示,對商品名建立雜湊表,借用STL裡的MAP類。3、        

排序_Shell_Sort(希爾排序)

希爾排序還是不錯的,時間複雜度在O(n^1.3)這是我自己寫出來的代碼,我什麼也沒看別人的代碼就是根據自己的理解自己敲出來的,大家看看:#include <stdio.h>#include <string.h>#include <math.h>#include <iostream>#include <algorithm>#include <string>using namespace std;int

poj_1050To the Max

To the MaxTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 36015 Accepted: 18897DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within

八皇后問題求解

描述在國際象棋棋盤上放置八個皇后,要求每兩個皇后之間不能直接吃掉對方。輸入無輸入。輸出按給定順序和格式輸出所有八皇后問題的解(見Sample Output)。範例輸入範例輸出No. 11 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 No. 21 0 0 0 0 0 0 0 0 0 0 0 0

9.2.1(DAG的dp)

暈死,,,反正是對不了..都是自己寫代碼的風格不行呀,,怎麼也寫不對了- -#煩死了都,,,不知道是怎麼錯了..好像和別人寫的差不多呀自己的:#include <stdio.h>#include <string.h>#include <iostream>#include <string>#define max(a, b) (a) > (b) ? (a) : (b)using namespace std;struct node{int

poj 3041 匈牙利演算法

/* poj 3041 匈牙利演算法 題目大意:每次開槍能清除一行或者一列,問最少開多少槍能清理完 分析:將每一行和每一列看做兩個點 而小行星看做連結兩點的線 舉個例子看:第i行(列)看做點行i,點列i, 假設第一行上所有格子都有小行星,那麼也只能匹配一個列i,也就是一槍就掃除了該行 假設第一列上所有格子都有小行星,那麼也只能匹配一個行i,也就是在該列上只有一槍

poj 1276 多重背包

/* poj 1276 多重背包 題目的意思大概是能給定一個需要籌集到的貨幣m, 給定擁有的幾個貨幣數量n[i]和價值v[i],問你最多能籌到多少錢 是一個多重背包問題 dp[j]代表容量為j的背包最多能裝多少價值的物品 一般遇到多重背包的解法是將其轉化成完全背包和01背包去解 代碼如下:*/#include <cstdio>#include <algorithm>using namespace std;#define

poj 3020 最小覆蓋路徑

/* poj 3020 最小路徑覆蓋 題目一開始沒看懂 囧 參考了網上的代碼,這是個最小路徑覆蓋的問題 o代表不需要覆蓋天線的地方 *代表需要覆蓋天線的地方 一根天線可以惠及兩個相鄰的*點,問最少需要多少天線才能把所有*點覆蓋完 無向二分圖的最小路徑覆蓋=點數-最大匹配/2 建模過程:將每個*點看做點,進行拆點*/#include <cstdio>#include <cstring>using namespace std;

排序_Shell_Sort(希爾排序)更正版

希爾排序,可以更正的一點就是,增量是設計成偶數,還是設計成奇數,還是不用去管它,是什麼樣就是什麼樣呢?通過看前任的研究,可以發現,增量設計成奇數是可以減少點計算量的,但效果也不會很明顯.呵呵,不過,做知識還是要嚴謹一些比較好.貼出代碼:#include <stdio.h>#include <string.h>#include <math.h>#include <iostream>#include <string>#include

HDU-2199(search_bin-精度)

這個真的是,,,我頭一次見到這麼好玩的事情...以前做題從來都沒有考慮過這種事情呀,,,精度處理不對,題目是出不來的,,,,這種可真是考驗人的耐性呀,,,,下次直接把eps開的更小一點?事實我剛才給證明了,,我第一次開的是1e-8顯然不行,而小於1e-13的都可以..嘿嘿.所以以後一定要注意沒事,使勁開吧....呵呵.,因為你開的越小越接近答案...吃一塹長一智呀.貼出代碼:#include <stdio.h>#include <string.h>#include

排序_Dir_Choose(直接選擇排序)

這是以前用的最多的一種排序,而我今天還在想什麼才是選擇排序呢..可想而知自己的基礎打得是多麼的不牢實了...#include <stdio.h>#include <string.h>#include <math.h>#include <iostream>#include <algorithm>#include <string>#define inf 0x3fffffffusing namespace std;int

data structure test

1、設計演算法,對帶頭結點的單鏈表實現就地逆置。並給出單鏈表的儲存結構(資料類型)的定義。#include <iostream>#include <cstdlib>#include <cstdio>#include <ctime>using namespace std;typedef char ElemType;typedef struct Node{ElemType data;struct Node *next;}Node, *LinkList;

排序_Bubble_sort(冒泡排序)

冒泡排序,時間複雜度是O(n^2),但是它的有點也十分優越,那就是比較容易敲出來代碼,而且相對穩定,是一種穩定的排序方法.貼出代碼:#include <stdio.h>#include <string.h>#include <math.h>#include <iostream>#include <algorithm>#include <string>#define inf 0x3fffffffusing namespace

HDU-2222(AC_自動機)

我什麼都不想說了,我今天就是為了研究AC自動機的,,可是一天過去了,,自己還是什麼都不懂!我真想死了...自己看著別人的代碼敲都敲不對,我真崩潰了,不想放棄,但是,自己不放棄還真是不行..我真的沒有時間再去鑽研這個東西了. 明天還有很重要的任務需要完成...ac自動機....會有徵服你的那一天的!貼出別人的代碼://AC自動機 HDU 2222

hdu 1556 線段樹

/* hdu 1556 線段樹 要成段更新資料 否則會造成逾時!~~~~*/#include <cstdio>#include <cstring>using namespace std;#define maxn 100005int ans[maxn];int k;struct Node{ int l,r,v;}node[maxn*4];int n;void build(int i,int ls,int rs){

hdu 1086 求線段交點個數

/* hdu 1086 求線段交點個數 */#include <cstdio>#include <algorithm>using namespace std;#define maxn 105int n;struct point{ double x, y;}s[maxn],e[maxn];//叉積double multi(point p0, point p1, point p2){ return ( p1.x - p0.x )*( p2.y - p0

hdu 2063 匈牙利演算法

/* hdu 2063 最大二分匹配 匈牙利演算法 我做的第一道二分匹配題目~*/#include <cstdio>#include <cstring>using namespace std;#define maxn 505bool used[maxn];bool map[maxn][maxn];int match[maxn];int m,n,k;bool find(int x){ for(int i = 1; i &

hdu 1392 凸包

/* hdu 1392 凸包 模板題*/#include <cstdio>#include <stdlib.h>#include <math.h>#include <conio.h>#include <algorithm>using namespace std;#define maxn 200#define inf 1e-6typedef struct{ double x; double y;}point;

總頁數: 61357 1 .... 24152 24153 24154 24155 24156 .... 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.