原创 HDU 1848 Fibonacci again and again(學習sg函數後寫出來的第一個題)

HDU1848 Fibonacci again and again Description 任何一個大學生對菲波那契數列(Fibonacci numbers)應該都不會陌生,它是這樣定義的: F(1)=1; F(2)=2;

原创 C++ STL優先隊列常用用法

優先隊列(priority queue) 普通的隊列是一種先進先出的數據結構,元素在隊列尾追加,而從隊列頭刪除。在優先隊列中,元素被賦予優先級。當訪問元素時,具有最高優先級的元素最先刪除。優先隊列具有最高級先出 (largest

原创 HDU 5831 Rikka with Parenthesis II (棧&思維)

Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some m

原创 HDU 5810 Balls ans Boxes(二項分佈)

Problem Description Mr. Chopsticks is interested in random phenomena, and he conducts an experiment to study randomnes

原创 HDU 5762 Teacher Bo(暴力+思維)

Problem Description Teacher BoBo is a geography teacher in the school.One day in his class, he marked N points in the m

原创 HDU 5828 Rikka with Sequence(線段樹+小優化)

Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some m

原创 GH60--來自geekhack的超強玩具

作爲一名大二代碼狗,每天接觸最多的就是鍵盤。 作爲一名常年混跡卡吧機吧各種吧的貼吧潛水員,怎麼着也得弄個機械鍵盤玩玩(並不是說薄膜的不好) 大二上學期擁有了第一把屬於自己的機械鍵盤 ikbc g104,順便弄了套彩虹鍵帽,當時愛不釋手,

原创 兩圓相交面積萬能版

struct point{ double x, y; }; double dis(point a, point b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)

原创 HDU 2509 Be the Winner(Anti-Nim)

Problem Description Let’s consider m apples divided into n groups. Each group contains no more than 100 apples, arrang

原创 HDU 5775 Bubble Sort(逆序對)

Problem Description P is a permutation of the integers from 1 to N(index starting from 1). Here is the code of Bubble

原创 HDU 5726 GCD(RMQ+二分)(線段樹也可)

Problem Description Give you a sequence of N(N≤100,000) integers : a1,...,an(0<ai≤1000,000,000). There are Q(Q≤100,000)

原创 HDU 5742 It's All In The Mind(貪心?)

Problem Description Professor Zhang has a number sequence a1,a2,...,an. However, the sequence is not complete and some

原创 HDU 5744 Keep On Movin(胡搞)

Problem Description Professor Zhang has kinds of characters and the quantity of the i-th character is ai. Professor Zh

原创 HDU 1729 Stone Game(思維 & SG函數)

Problem Description This game is a two-player game and is played as follows: There are n boxes; each box has its size

原创 HDU 5795 A Simple Nim(SG打表找規律)

Problem Description Two players take turns picking candies from n heaps,the player who picks the last one will win the