原创 hdu 2289

簡單二分 主要是圓臺體積公式 水平面的半徑u可以根據直角梯形的面積求出:(r+u)*h + (u+R)*(H-h) = (r+R)*H得出(R-r)*h = (u-r)*H得 u = r + (R-r)*h/H圓臺體積計算公式:V= π*

原创 hdu 2438

在網上看到兩種方法 始終不能理解另一種方法 還好另外一種方法正確性顯而易見 車轉彎的時候車有段與地面的夾角角度是從0度變化到90度的。也就是轉彎的時候需要一個最大的寬度才能過去。  否則就卡在 那裏了。這個寬度PH是先增加後減少

原创 hdu 3732

Ahui Writes Word Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submissi

原创 hdu 1556 Color the ball

1 標記起點   -1 標記終點 #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int N = 100000

原创 hdu 1286 找新朋友

歐拉函數 #include <iostream> using namespace std; int ef(int n); int main() { int m, n; cin >> n; while (n--

原创 poj 1850

排列組合... 長度爲n的總方案共有 c (26, n) 對於 vwxyz 來說  是從 a ->  ab -> abc -> abcd ->abcde ->vwxyz 所以先加上之前的總組合數 c (26, 1) + c (26, 2

原创 hdu 3652

總算自己套模版套出來一道 雖然是思維 不過代碼比三維的精簡 #include <iostream> #include <algorithm> #include <queue> #include <cstring> #include <c

原创 hdu 2899

很簡單的三分  也可以求導 二分 #include <iostream> #include <algorithm> #include <queue> #include <cstring> #include <cstdio> #inclu

原创 關於STL中vector使用unique()去重的問題

STL中Unique函數的作用是去除相鄰重複元素 #include #include #includeusing namespace stdint main() {int a[10] = {7,4,1,7,4,1,7,4,1,0}; s

原创 位運算總結

常用的有 判斷奇偶   & if(a & 1)== 1    則a是奇數     if (a&1) == 0  則 a是偶數 >>     a >> = n  相當於 a /  2^ n <<    a <<=  n  相當於  a*

原创 hdu 3756

三分 首先三維變二維 L這條線必定和某一 個給定的點擦邊,也就是經過那個點,我們假設它經過P(a, b), 並且L的斜率 爲K(K < 0),那麼L的方程就可以表示爲 L:  y = K * (x - a) + b,則H和R就 可以利

原创 hdu 1712

ACboy needs your help Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submis

原创 hdu 1063

#include <iostream> #include <algorithm> #include <queue> #include <cstring> #include <cstdio> #include <vector> #inclu

原创 hdu 1160 FatMouse's Speed

#include <iostream> #include <cstring> #include <algorithm> using namespace std; #define N 1100 struct node { int

原创 codeforces 55D Beautiful numbers

寫了兩道數位dp了 還是比較朦朧 #include <iostream> #include <algorithm> #include <queue> #include <cstring> #include <cstdio> #inclu