Hdu 3065 病毒侵襲持續中//Aho-Corasick Automaton

  這道題題目沒說是多case,所以無情wa了半個多小時。囧!AC自動機的水題,下面是代碼:#include<stdio.h>#include<string.h>#include<queue>#include<ctype.h>using namespace std;#define maxn 1010*50#define maxc 26int ch[maxn][maxc];int val[maxn];int f[maxn];int cnt;int

Hdu 1005 Number Sequence//矩陣快速冪

  裸的矩陣乘法加矩陣快速冪  下面是代碼:#include<stdio.h>#include<string.h>#define maxn 1010int A,B,n;struct node{ int m[2][2]; void init() { memset(m,0,sizeof(m)); }} a,b;node martix_mul(node a,node b){ node temp; temp.init();

poj 2762 Going from u to v or v to u (tarjan+縮點+dfs搜尋)

這道題大致想法沒有問題,首先要縮點,然後重構圖,判斷重構的圖是不是弱連通。這裡有分析可知,不管圖是什麼樣的,裡面一定存在一條鏈,從入度為0的點走到出度為0的點,這一路上要包括所有的點。要想任意兩點都能弱連通,那麼必然邊的方向是一定。tarjan縮點,重構圖就不用解釋了,主要是後面怎麼判斷DAG是不是有一條鏈包括所有的點。這裡用的是dfs搜尋,查過其他牛們的部落格,還有拓撲排序(如果刪掉一個點後,新出現兩個或多個入度為的點,說明這些新出現的入度0的點都是來自刪去的點,它們之間不連通),還有就是dp

Poj 1977 Odd Loving Bakers//矩陣

  這道題,推一下關係式就出來了。 下面是代碼:#include<stdio.h>#include<string.h>#include<string>#include<map>using namespace std;const int maxn = 100 + 10;string s;char str[maxn];map<string,int> Map;struct node{ int m[maxn][maxn];

hdu 1914 The Stable Marriage Problem(延遲認可演算法)

這篇解釋得比較好:    

POJ 1018 滑雪

題目大意:人往低處滑雪,求滑雪滑出最長長度思路:d[i][j]=max{dp[i-1][j]+1,dp[i+1][j]+1,dp[i][j-1]+1,dp[i][j+1]+1},當然要滿足一些基本條件:高低.  這裡是用記憶化搜尋 AC program:#include<iostream>#include<stdio.h>#include<string.h> using namespace std;int map[105][105];int dir[4][2]

UVa Problem 10258 Contest Scoreboard (比賽計分板)

// Contest Scoreboard (比賽計分板)// PC/UVa IDs: 110207/10258, Popularity: B, Success rate: average Level: 1// Verdict: Accepted// Submission Date: 2011-05-23// UVa Run Time: 0.008s//// 著作權(C)2011,邱秋。metaphysis # yeah dot net////

網頁製作初步

剛學html 各方面還不完善 貌似還是覺得c,c++比較簡單~~下面寫了一個顧城的小詩的html 網頁 好搓~~ 一點點成長吧~~<html><head><title>顧城-遠和近</title><head><body align = "center" style = "background-color: gray" ><p align = "center" >遠和近</p><strong &

uva 10765 – Doves and bombs(割點&BCC)

Problem GDoves and BombsInput: Standard InputOutput: Standard Output Time Limit: 2 SecondsIt is the year 95 ACM (After the Crash of Microsoft). After many years of peace, a war has broken out. Your nation, the island of Evergreen Macros And

UVa Problem 10010 Where’s Waldorf?(尋找單詞)

// Where’s Waldorf? (序找單詞)// PC/UVa IDs: 110302/10010, Popularity: B, Success rate: average Level: 2// Verdict: Accepted// Submission Date: 2011-05-22// UVa Run Time: 0.016s//// 著作權(C)2011,邱秋。metaphysis # yeah dot net////

uva 10369 – Arctic Network(最小產生樹)

文章目錄 Sample InputSample Output Problem C: Arctic NetworkThe Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used

HDOJ2098 分拆素數和

#include<iostream>using namespace std;bool prime(int x){// prime 函數判斷一個數是否為素數 for(int i=2;i*i<=x;i++)//只需要窮舉到√n if(x%i==0) return false; return true; }int main(){ int n,count,i; while(scanf("%d",&n)

UVa Problem 10082 WERTYU (WERTYU 鍵盤)

// WERTYU (WERTYU 鍵盤)// PC/UVa IDs: 110301/10082, Popularity: A, Success rate: high Level: 1// Verdict: Accepted// Submission Date: 2011-05-17// UVa Run Time: 0.012s//// 著作權(C)2011,邱秋。metaphysis # yeah dot net#include <iostream>using namespace

UVa Problem 10315 Poker Hands (撲克牌型)

// Poker Hands (撲克牌型)// PC/UVa IDs: 110202/10315, Popularity: C, Success rate: average Level: 2// Verdict: Accepted// Submission Date: 2011-05-23// UVa Run Time: 0.008s//// 著作權(C)2011,邱秋。metaphysis # yeah dot net////

UVa Problem 10149 Yahtzee (Yahtzee 遊戲)

// Yahtzee (Yahtzee 遊戲)// PC/UVa IDs: 110208/10149, Popularity: C, Success rate: average Level: 3// 著作權(C),邱秋,2011。metaphysis at yeah dot net// Verdict: Accepted// Submission Date: 2011-05-16// UVa Run Time: 0.088s////

Hdu 1757 A Simple Math Problem//矩陣乘法

  唉,是一道水題,但是錯把b也為a,狂wa。。。  還有每次模數,否則,溢出。   下面是代碼:#include<stdio.h>#include<string.h>#define maxn 15struct node{ int m[maxn][maxn]; void init() { memset(m,0,sizeof(m)); }} A,B;int k,m;void init(){ A.init();

UVa Problem 10142 Australian Voting (澳大利亞投票)

// Australian Voting (澳大利亞投票)// PC/UVa IDs: 110108/10142, Popularity: B, Success rate: low Level: 1// Verdict: Accepted// Submission Date: 2011-05-22// UVa Run Time: 0.844s//// 著作權(C)2011,邱秋。metaphysis # yeah dot net#include <iostream>#include

AC自動機相關

   關於AC自動機,沒有多講的。別人講的在多也不如自己去看論文。這就是真理啊。  下面是:   Aho-Korasick Automaton的原版論文   notonlysuccess部落格推薦的論文   AC 自動機就是要構造一個模式比對機   模式比對機有一系列的狀態(state),每個狀態用一個正整數表示   模式比對機還有狀態轉移函數和一個輸出函數   當來一個字元x時,模式比對機就處理這個字元,如果有這個字元確定的狀態,那麼就匹配下一個字元,沒有就狀態轉移。 

雙端堆/最小-最大堆/Double-Ended Heap ?

      Uva 11136 - Hoax or what 這道題可以用優先隊列做,這裡討論一下用最小-最大堆做。      題目的要求:需要找到最小值和最大值,並且還有刪除最小值和最大值。      這樣就需要一種包括下面幾種操作的資料結構:insert 插入一個元get_min() 得到最小元素,並將其從集合中刪除get_max()的到最大元素,並將其從集合中刪除   

hdu 1022 Train Problem I STL–棧的應

資料結構中典型的用棧解決的問題直接調用c++ STL模板庫中的棧就可以解決了#include<iostream>#include<stack>using namespace std;// 棧的五種操作stack <char> my; //定義棧my.empty() ; // 判斷棧是否非空my.size(); // 判斷棧中元素的個數my.push(a[i]); // 壓棧my.top(); // 取出棧頂元素my.pop(

總頁數: 61357 1 .... 13458 13459 13460 13461 13462 .... 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.