原创 hdu5493 樹狀數組+二分

題意有一羣人排隊,每個的身高都是獨一無二的,每個的只知道前面k個人比他高,或者後面k個人比他高,求身高字典序最小的一種排法 即將身高從矮到高排序,每次儘可能地使得當前這個人靠前就好了,每次放的時候能夠知道前面要留多少個空位給後面比他高的人

原创 hdu5491 位操作

給一個整數D,求比D大的且二進制含有1的個數在s1---s2之間的最小的整數 從高位往低位找D二進制中第一個從0到1的那個位,之後就儘可能地把剩下的1全部填在低位上,然後所有情況中取個最小值 #include<iostream> #in

原创 ubuntu 14.0.4 ARToolKit 配置

1 opengl配置  sudo apt-get install build-essential sudo apt-get install libgl1-mesa-dev  sudo apt-get install libglu1-me

原创 hdu1532 網絡流入門 dinic

#include <iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #inclu

原创 poj1113 凸包入門題

計算凸包周長和一個圓的周長 #include<iostream> #include<stdio.h> #include<string.h> #include<string> #include<stdlib.h> #include<cmat

原创 hdu3282 動態中位數(用堆實現)

題意是求一個動態的中位數,用兩個堆實現,一個是大根堆,一個是小根堆,且大根堆的元素個數等於小根堆的元素個數或者多一個,大根堆保存了比較小的前一半,小根堆保存了較大的後一半,每次求值的時候,取出大根堆的堆頂元素即可 #include<std

原创 中綴轉後綴(利用棧)

#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <vector> #include <queue> #inc

原创 計算幾何模板(自己整理)

int sgn(double x){return x<-eps?-1:x<eps?0:1;} struct Point{ double x,y; Point(){} Point(double _x,double _

原创 haskell 筆記

:set editor gedit :edit hello.hs 在跳出的gedit裏面輸入 main = putStrLn "Hello World!" :! ghc --make "hello.hs" 編譯 新建shell,輸入./

原创 編譯原理 子集構造法實現

輸入說明 第一行 點數n 邊數m 集合中字符數目k 第二行 集合中的字符 接下去m行 每一行三個值 起點 終點 經過的邊上的字符 輸出: 構造好的邊 新構造節點包含的原先的點的集合 #include <iostream> #incl

原创 poj2074 線段相交的視線問題

求出每個阻礙物的線段上擋住的區間,然後求出剩下的區域中最長的那一段,這裏可以利用-1 +1的思想,具體看代碼吧 #include<iostream> #include<stdio.h> #include<string.h> #includ

原创 hdu5486 離散化+並查集

#include<iostream> #include<stdio.h> #include<string.h> #include<string> #include<stdlib.h> #include<cmath> #include<qu

原创 poj2449 第k最短路,A*算法

估值函數 f(n)=g(n)+h(n)   ,f 表示從s到t經過點n的估值代價,g(n)表示從s到n的估值代價,h(n)表示從n到t的最優代價,即到t的最短路的長度 /* ********************************

原创 hdu5492 dp

最後公式化簡後是    (n-m+1)Ai^2-路徑和的平方 dp[i][j][k] 表示在i,j格子路徑和爲k的(n-m+1)Ai^2的最小值 最後答案是   dp[n][m][i]的最小值-路徑和的平方 #include<iostre

原创 前綴轉中綴(利用棧)

#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <vector> #include <queue> #inc