POJ1089解題報告 區間合并

IntervalsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5345 Accepted: 2087DescriptionThere is given the series of n closed intervals [ai; bi], where i=1,2,...,n. The sum of those intervals may be represented as a sum of closed pairwise

POJ 1930 解題報告 無限迴圈小數化分數

Dead FractionTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1258 Accepted: 379DescriptionMike is frantically scrambling to finish his thesis at the last minute. He needs to assemble all his research notes into vaguely coherent form in the

tarjan演算法的實現

自己將tarjan演算法實現了一遍,深入理解了一遍,感覺有所收穫~~  #include<iostream>using namespace std;int time=1,low[1000],dfn[1000];int stack[1000],top=0;bool instack[1000]={false};struct LIST{int v;LIST *next;};LIST *head[1000]={NULL};int min(int a,int

poj1088解題報告

DescriptionMichael喜歡滑雪百這並不奇怪, 因為滑雪的確很刺激。可是為了獲得速度,滑的地區必須向下傾斜,而且當你滑到坡底,你不得不再次走上坡或者等待升降機來載你。Michael想知道載一個地區中最長底滑坡。地區由一個二維數組給出。數組的每個數字代表點的高度。下面是一個例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9一個人可以從某個點滑向上下左右相鄰四個點之一,若且唯若高度減小。在上面的例子中,

poj 2516 最小費用最大流

/*首選的題,m個倉庫供應k種商品給n個商家,m*n條運輸代價互異,求滿足商家需求下的最小運輸費用顯然,如果某種商品的供貨量比需求大,肯定是無法達到要求的,所以開始要判別是否可以得到首選這個題非常有啟發意義,剛開始把k種商品一併考慮,tle了,想來也是,這樣X集合中的點為m*k,Y中集合為n*k;執行最小費用流這個複雜度為O(n^3)的演算法在這個題目是不可以行的考慮到k種商品是相互獨立的,所以見k次圖,每次圖中的點為n+m+2個,這樣就可以在時限內出答案了*/#include

POJ 1201 Intervals 差分約束+spfa

/*題意是給定區間[ai,bi],要就在區間上至少有ci個點,如果用S[i+1]表示區間[0,i]的點數,則題目要求就可以轉化為S[bi+1]-S[ai]>=ci;聯絡到求單源最短路時的鬆弛操作:若dis[v]>dis[u]+w[u][v],則dis[v]=dis[u]+w[u][v] ;即要求dis[v]<=dis[u]+w[u][v],對比此處的S[bi+1]>=ci+S[ai];所以本題可以用求最長路的方法求解。當然也可以按照差分約束的理論轉為求最短路,都差不多。

784 – Maze Exploration

描述:這道題就是利用遞迴填充圖的問題,沒什麼難度……直接AC就可以#include <iostream>#include <cstring>#include <cstdio>using namespace std;void dfs(char s[30][90],int row,int clow,int visit[30][90]){ if(s[row][clow]=='X'||visit[row][clow])return; visit[row][

分解質因數演算法

 #include<stdio.h>#include<math.h>int main(){ int n,i; while(scanf("%d",&n)&&n) { for(i=2;i<=sqrt(n);i++) if(n%i==0&&(n/=i)) printf("%d ",i--); printf("%d/n",n); }

coj 1123 帶區間操作的線段樹(lazy)

Light SwitchingTime Limit:3000MS  Memory Limit:65536KTotal Submit:183 Accepted:42DescriptionFarmer John嘗試通過和奶牛們玩益智玩具來保持他的奶牛們思維敏捷. 其中一個大型玩具是 牛欄中的燈. N (2 <= N <= 100,000) 頭奶牛中的每一頭被連續的編號為1..N, 站在一個 彩色的燈下面. 剛到傍晚的時候, 所有的燈都是關閉的. 奶牛們通過N個按鈕來控制燈的開關;

10066 – The Twin Towers

描述:尋找最長子序列問題,前面好幾道都是這樣的題#include <cstdio>#include <cstring>int max(int a,int b){ if(a>b) return a; else return b;}int num[110][2],s[110][110];int main(){ //freopen("a.txt","r",stdin); int n,m,flag=1; while(scanf("%d %d",

POJ1523解題報告 求點割集

SPFTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2082 Accepted: 932DescriptionConsider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis, a failure

10706 – Number Sequence

描述:題目的意思就是給你一個數,輸出這個數的位置為什麼數,當然,規律很簡單,就是從小一直遞增起來的,我的思路就是把這些數全都暴出來,然後查詢就可以了#include <cstdio>#include <cstdlib>long num[40000];char str[1000000];long count,n,m;void solve(){ num[1]=1; count=2; str[1]='1'; for(int i=2; i<40000

HDU 4001 To Miss Our Children Time 最長路, DP

/*最長路實現*/#include <cstdio>#include <iostream>#include <memory.h>#include<queue>#include<set>#include<ctime>#include<algorithm>#include<cmath>#include<vector>#include<map>using namespace std;

scu四川大學oj 3099 A Simple Problem with Integers

題目出處http://cs.scu.edu.cn/soj/problem.action?id=3099線段樹題目中有一個操作是為某個區間的所有成員加上c;用 d表示此時整個區間所有元素的增量 #include <iostream>using namespace std;#define ll long longconst int MAXN = 100001;struct { int l, r; ll s, d;} nod[MAXN*3];int a[MAXN];void

HDU 1429 勝利大逃亡(續) 狀態壓縮BFS

/*選項組的bfs,用到了二進位狀態壓縮http://acm.hdu.edu.cn/showproblem.php?pid=1429*/#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include<queue>#define N 20010using namespace std;struct State{int

592 – Island of Logic

自己想了好長時間也沒有想出來該怎麼做,看到別人代碼也有些不懂,慚愧……下面是轉載的別人的代碼:人數最多隻有5個人,加上時間,所以可以用6個迴圈枚舉所有的情況。 輸入的時候可以根據某個特定的字元去判斷這個陳述的內容,比如帶有'd'的是'divine'。 判斷該陳述是否合法還要結合說話人的身份去判斷。如果所有的陳述都合法,那麼枚舉的這種情況是可能的,把它儲存下來,枚舉完所以情況後再進行判斷。

poj 1087 最大流

#include <cstdio>#include <iostream>#include<queue>#include<set>#include<ctime>#include<algorithm>#include<cmath>#include<vector>#include<map>#include<cstring>using namespace std;const int

HDU 3065 病毒侵襲持續中 AC自動機

/*很裸的AC自動機, 關鍵是如何去掉模式串中的不相干字元 */ #include<cstdio> #include<cstring> #include <iostream> #include<algorithm> #include<queue> #include<set> using namespace std; const int kind = 26; int ans[1009]; struct node{

POJ 3159 Candies 差分約束+spfa

/*不知道為什麼寫成隊列就過不了,寫成棧就過了……題意是:班長分糖果,每個學生心中都有一個標準,a b c 既 a學生認為b的糖果數應滿足b-a<=c;最後求差異最大,既分到最多糖果數-分到最少糖果數目建圖依據參見:http://blog.csdn.net/wsniyufang/article/details/6626046代碼一:轉換為最短路問題*/#include<iostream>#include<cstdio>#include<cstring>#

poj 3281 Dinic模版題

【題目大意】 有F 種食物和D 種飲料,每種食物或飲料只能供一頭牛享用,且每頭牛隻享用一 種食物和一種飲料。現在有 N  頭牛,每頭牛都有自己喜歡的食物種類列表和飲 料種類列表,問最多能使幾頭牛同時享用到自己喜歡的食物和飲料。(1   <=   F   <= 100, 1 <= D <= 100, 1 <= N <= 100)  【建模方法】 此題的建模方法比較有開創性。以往一般都是左邊一個點集表示供應並與源相連, 右邊一個點集表示需求並與匯相連。現在不同了,

總頁數: 61357 1 .... 13831 13832 13833 13834 13835 .... 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.