POJ-1679-The Unique MST

POJ-1679-The Unique MSThttp://poj.org/problem?id=1679次小產生樹,prim稍作改變即可,每次加入新的頂點時,如果有不止一條權值最小的最短邊,則說明最小產生樹不只一種#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>using namespace std;#define N 105#define INF 99999

POJ-2728-Desert King

POJ-2728-Desert Kinghttp://poj.org/problem?id=2728有N個村莊,給出每個村莊的座標和海拔,,benifit為兩點之間的距離,cost為兩點的高度差,現在要求一棵樹使得 cost / benift 最小,即求一個最優比例產生樹第一次遇見這種產生樹,在網上找了個解法假設sigma(h)/sigma(l)==K 均值K可取,即:

cf192 div2 A. Cakeminator

A. Cakeminatortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For example, a 3 

cf 193 div2 A. Down the Hatch!

A. Down the Hatch!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEverybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they

cf 192 div2 B. Road Construction

B. Road Constructiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA country has n cities. Initially, there is no road in the country. One day, the king decides to construct some roads

POJ-2251-Dungeon Master

POJ-2251-Dungeon Masterhttp://poj.org/problem?id=2251基本的三維BFS,用隊列寫的#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>using namespace std;int n1,n2,n3;char map[40][40][40];int visit[40][40

HDU-1272-小希的迷宮

HDU-1272-小希的迷宮http://acm.hdu.edu.cn/showproblem.php?pid=1272基本的並查集#include<iostream>#include<cstdio>using namespace std;#define N 100010int f[N];int mark[N];int find(int x){int r=x;while(f[r]!=r)r=f[r];f[x]=r;return f[x];}void merege(int

HDU-1427-速算24點

HDU-1427-速算24點http://acm.hdu.edu.cn/showproblem.php?pid=14274個數通過 +,—,*,/和加括弧,計算得24,枚舉數字和運算子,DFS即可,注意題目要求計算過程中都不能出現小數,所以做除法時稍作處理枚舉數組可用algorithm裡的next_permutationThe next_permutation() function attempts to transform the given range of elements [start,

codeforces-320A-Magic Numbers

http://codeforces.com/problemset/problem/320/AA magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of times. Therefore14144, 141414 and 1411 are magic numbers but 1444, 514 and 414

HDU-1298-T9

HDU-1298-T9http://acm.hdu.edu.cn/showproblem.php?pid=1298很好的一題,字典樹+DFS,思路參考swm8023大牛的題意是類比手機IME,給出幾個單詞即頻度,再給出幾個數字串,確定對於給定的一個數字串,每輸入一個數字,將顯示什麼字元本題的數字串的每一個數字均代表一個字母,而不是平常的手機,多個數字可能代表一個字母,首先可將給出的單詞即頻度記錄到字典樹中,對於數字串進行DFS,尋找其可能表示的頻度最大的字串例如    ab  2       

HDU-1548-A strange lift

HDU-1548-A strange lifthttp://acm.hdu.edu.cn/showproblem.php?pid=1548基本的BFS,上下兩個方向搜尋#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>using namespace std;int n;int visit[205];int num[205]

POJ-3040-Asteroids

POJ-3040-Asteroidshttp://poj.org/problem?id=3041X表示一個敵人,給出所有敵人的座標,炸彈可以炸掉該炸彈所在一行或者所在的一列,求最少需要多少個炸彈才能炸掉所有的敵人對於每一個敵人,炸彈要麼在該敵人所在的行,要麼在該敵人所在的列,將敵人的所在行當作X集合,敵人所在列當作Y集合,每個敵人的X和Y連一條邊,那麼題目就轉為求最小點覆蓋,最小點覆蓋等於最大匹配#include<cstdio>#include<cstring>#incl

HDU-1075-What Are You Talking About

HDU-1075-What Are You Talking Abouthttp://acm.hdu.edu.cn/showproblem.php?pid=1075字典樹#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>using namespace std;struct node{int count;node *childs[26];char

HDU-4038-Saving Princess Claire

HDU-4038-Saving Princess

HDU-1240-Asteroids!

HDU-1240-Asteroids!http://acm.hdu.edu.cn/showproblem.php?pid=1240三維的BFS,和二維的差不多#include<stdio.h>#include<string.h>#include<stdlib.h>char map[12][12][12];int visit[12][12][12];int ans[12][12][12];int n;int dir[6][3]={{1,0,0},{-1,0,0}

【HDU2717】-Catch that cow

題目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2717這點需要特別注意的是HDU特別坑爹,POJ上是單組資料,多點測試,HDU是一點測試,多組資料!所以在POJ上把while(cin >> N >> K)去掉也是AC的,簡單的BFS#include <iostream>#include <stdio.h>#include <queue>#include

ZOJ-3642-Just Another Information SharingProblem

ZOJ-3642-Just Another Information

POJ-2060-Taxi Cab Scheme

POJ-2060-Taxi Cab

把一切推翻,重新再來

渾渾噩噩恍恍惚惚走到了大二下學期,這兩年總是感覺什麼都急著速成,卻什麼都沒有做成。所以現在,一拳揍倒以前的自己,重新再來吧。 關鍵詞:WEB搜尋, WEB挖掘, 網路爬蟲,

HDU-1565-方格取數(1)

HDU-1565-方格取數(1)http://acm.hdu.edu.cn/showproblem.php?pid=1565我的第一個狀態壓縮DP給你一個n*n的格子的棋盤,每個格子裡面有一個非負數,從中取出若干個數,使得任意的兩個數所在的格子沒有公用邊,就是說所取的數所在的2個格子不能相鄰,並且取出的數的和最大375 15 21 75 15 28 34 70

總頁數: 61357 1 .... 7795 7796 7797 7798 7799 .... 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.