原创 hdu Examining the Rooms

這道題的知識點第一次聽說 ,就是應用斯特林數。題目的意思是給你房間數N,和最多能破門的個數,讓你求能全部把房間打開的概率! a[i][j]=a[i-1][j-1]+(i-1)*a[i-1][j]; #include <cstdio>

原创 poj 2186 Popular Cows

http://poj.org/problem?id=2186 題意: N頭奶牛,給出若干歡迎關係a,b,表示a歡迎b,歡迎關係是單向的,但也是可以傳遞的,另外每個奶牛都是歡迎他自己的。求出被所有奶牛歡迎的奶牛的數目。 #include <

原创 poj 2886 Who Gets the Most Candies?

http://poj.org/problem?id=2886 題意:   N個孩子順時針坐成一個圓圈且從1到N編號,每個孩子手中有一張標有非零整數的卡片。第K個孩子先出圈,如果他手中卡片上的數字A大於零,下一個出圈的是他左手邊第A個

原创 poj 2892 Tunnel Warfare

http://poj.org/problem?id=2892 這道題就是有一系列連續的村莊,然後有一些操作,包括對村莊破壞和修復、查詢。就是求某個點所在最長連續區間。 用線段樹維護區間內左端點往右的最長連續區間的長度len和右端點往左的最

原创 poj 3592 Instantaneous Transference

http://poj.org/problem?id=3592 這道題先有tarjan算法縮點,然後再建圖,再有spfa算法求最長路。 #include <cstdio> #include <cstring> #include <algor

原创 poj3264 Balanced Lineup

http://poj.org/problem?id=3264 這道題就是求一個區間的最大值與最小值的差,用的線段樹做的。 #include <cstdio> #include <cstring> #include <algorithm>

原创 poj 3114 Countries in War

http://poj.org/problem?id=3114 這道題和poj 3592 一樣,先縮點再spfa求最短路 #include <cstdio> #include <cstring> #include <queue> #incl

原创 poj 1195 Mobile phones

http://poj.org/problem?id=1195 #include <cstdio> #include <cstring> #include <algorithm> #define maxn 1026 using namesp

原创 poj 3694 Network

http://poj.org/problem?id=3694 tarjan算法的應用,數組開的要大,還有新加的邊。 #include <cstdio> #include <cstring> #include <algorithm> #d

原创 poj 3308 Paratroopers

http://poj.org/problem?id=3308 #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <cma

原创 poj 2352 Stars

http://poj.org/problem?id=2352 題意:給你一些y遞增(y相等,x遞增)的座標,按照在一個點的左方並且在下方(包括垂直方向的)的點的個數劃分等級,求1到n-1的等級的個數。 #include <cstdio>

原创 Centos7 安裝Rabbitmq

1. Rabbitmq  服務端基於Erlang語言編寫,首先在安裝rabbitmq 之前安裝erlang 環境。 ·安裝erlang: 安裝依賴環境: yum install build-essential openssl opens

原创 hdu Largest prime factor

#include <cstdio> #include <cstring> #include <algorithm> #define maxn 1000100 using namespace std; int f[maxn]; void

原创 ural 1203. Scientific Conference

http://acm.timus.ru/problem.aspx?space=1&num=1203 #include <cstdio> #include <cstring> #include <algorithm> #define max

原创 poj 3130 How I Mathematician Wonder What You Are!

http://poj.org/problem?id=3130 這道題和poj 3335基本上一樣,就是輸入順序不一樣,這個是逆時針。這道題就是求多邊形是不是有核,用半平面交求。 半平面交定義:對於任何平面,任何直線都能將平面劃分成兩部分,