hdu2767 強連通

題意是加多少條邊能使圖成為強連通。。。。將一個強連通分量縮成一個點,構成一個DAG,添加至少max(入度為0的個數,出度為0的個數)條邊即可,原因不好解釋。。DAG每個入度不為0的點可以由某個入度為0的點出發到達(yy一下就能明白),把出度為0的點連向入度為0的點即可。。max(入度為0的個數,出度為0的個數)#include <iostream>#include <cstring>#include <cstdio>using namespace

什麼是浮躁~

從十七八歲到二十七八歲的差不多十年時間裡,大多數人都處於浮躁狀態。如果你恰好這樣,只能表明一件事情:你很正常——還是那句話:相信我,你並不孤獨。浮躁的第一個原因,是因為因為學習並精通一項技能,往往需要5到10年時間。浮躁是這樣產生的:這東西有用沒用?問了自己這個問題之後,最終選擇的並不是真正有用的,而是感覺有用的。做著做著,又發現原本感覺有用的,現在又感覺沒用了。放棄。看看身邊的人,總是有比自己強的,於是非常苦惱。每天重複著以上的迴圈。明知道自己煩躁,卻又無能為力……~~怎麼和我這麼相符。。。

hdu1575 快速冪

#include <iostream>#include <cstring>#include <cstdio>#define MAX 15using namespace std;struct matrix{ int num[MAX][MAX]; matrix() { memset(num,0,sizeof(num)); }};matrix res;matrix A;int n,k;matrix

hdu1384差分約束

http://acm.hdu.edu.cn/showproblem.php?pid=1384題目看了半天~~思路:http://acm.miyuoo.com/2011/08/05/poj-1201hdu-1384-intervals-%E5%B7%AE%E5%88%86%E7%BA%A6%E6%9D%9F-spfa.html#include <iostream>#include <cstring>#include <cstdio>#include

hdu 1677 Nested Dolls【貪心解嵌套娃娃問題】

連結:http://acm.hdu.edu.cn/showproblem.php?pid=1677http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28195#problem/ENested DollsTime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s):

hdu3046 最小割

Pleasant sheep and big big wolfTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1601    Accepted Submission(s): 687Problem DescriptionIn ZJNU, there is a well-known prairie. And it attracts

hdu 4414 Finding crosses【簡單類比】

題目:http://acm.hdu.edu.cn/showproblem.php?pid=4414CSUST:點擊開啟連結Finding crossesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 729    Accepted Submission(s): 411Problem DescriptionThe Nazca Lines

圖論500題

轉載來自:http://blog.csdn.net/ffq5050139/article/details/7832991=============================以下是最小產生樹+並查集======================================【HDU】1213 How Many Tables基礎並查集★1272 小希的迷宮基礎並查集★1325&&poj1308 Is It A Tree?基礎並查集★1856 More is

POJ 2109 Power of Cryptography

不知道那裡貪心了。。。學長說貪心。注意:資料類型範圍,還是不太瞭解;原題連結:http://poj.org/problem?id=2109Power of CryptographyTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 13983 Accepted: 7136DescriptionCurrent work in cryptography involves (among other things) large prime

POJ 2965 The Pilots Brothers’ refrigerator【枚舉+dfs】

題目:http://poj.org/problem?id=2965來源:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26732#problem/B題意:就是把題目中給出的狀態圖,全部翻轉成----------------狀態翻轉: 每次翻轉一個,那麼它所在的行和列都要翻轉問最小翻轉次數,同時輸出翻轉路徑.演算法:暴力 + 枚舉 +

hdu 1051 Wooden Sticks【貪心】

Wooden Sticks Problem DescriptionThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some time, called setup time, for

hdu1150 匈牙利演算法

http://acm.hdu.edu.cn/showproblem.php?pid=1150圖的最小點覆蓋數 =

sgu 195 New Year Bonus Grant【簡單貪心】

連結:http://acm.sgu.ru/problem.php?contest=0&problem=195http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26733#problem/E195. New Year Bonus Granttime limit per test: 1.5 sec.memory limit per test: 65536 KBinput: standardoutput: standardAll

hdu 1811 拓撲排序,查並集

先鄙視一下自己哎~~忘初始化一個數組結果一直wa對照別人代碼找了好久~~~這是一道很好的題,考驗自己的基本功~~先是用鄰接矩陣結果記憶體超出~~~~寫鄰接表花了好一陣~~~一下代碼:#include <cstdio>#include <cstring>#include <queue>using namespace std;int parent[10005];int l[20005],r[20005];char c[20005];int in

hdu3491 最小割

ThievesTime Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 997    Accepted Submission(s): 448Problem DescriptionIn the kingdom of Henryy, there are N (2 <= N <= 100) cities, with M (M <= 10

藍橋練習部分題

5順時針螺旋數:#include<stdio.h>#include<string.h>int map[25][25];int main(){ int n; while(scanf("%d", &n) != EOF) { memset(map, 0, sizeof(25)); int temp = 1; int x , y; int up = 1, down = n; int

hdu 1569 最大點權獨立集

和hdu1565很像,但此題必須用鄰接表存~用判斷奇偶進行建立二分圖#include <iostream>#include <cstdio>#include <cstring>#include <queue>#define inf 99999999using namespace std;struct node{ int u,v,f;};node e[60000];int map[55][55],first[2505],cc;int next[

hdu2433 bfs+最佳化

TravelTime Limit: 10000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1120    Accepted Submission(s): 381Problem Description      One day, Tom traveled to a country named BGM. BGM is a small country, but

hdu 4604 二分+dp

好 蛋疼 終於ac了~~實際就是求從某個點開始,的最長不降子序列和最長不升子序列之和 減去兩個中重複的數字~#include <cstring>#include <iostream>#include <cstdio>using namespace std;const int inf=0x3f3f3f3f;int num[100005];int q1[100005];int q2[100005];int res[100005];void Scan(int

POJ 1456 Supermarket【貪心 + 並查集】

題意:給你 N 件不同的商品,每件商品最多可以買一次。      每件物品對應兩個值 pi   di      pi 表示物品的價值,di 表示可以買的最遲時間(也就是第一天到第 di 天都可以買這件物品)      規定:每天最多可以買一件物品,問你可以得到的最大價值。演算法:貪心      看了KB神的題解,他用的並查集,等下貼個代碼。思路【貪心版本】:將物品按照價值從大到小排序                  依次枚舉每件物品                 

總頁數: 61357 1 .... 19232 19233 19234 19235 19236 .... 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.