原创 【Codeforces-140C】New Year Snowmen(貪心+優先隊列、二分)

As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should

原创 【CodeForces - 305C】Ivan and Powers of Two(思維)

C. Ivan and Powers of Two time limit per test 0.5 seconds memory limit per test 256 megabytes input standard input outp

原创 【CodeForces - 122B】Lucky Substring(思維)

Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contai

原创 【CodeForces - 288B】Polo the Penguin and Houses (組合數學+Purfer序列)

Little penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a

原创 【CodeForces - 514B】Han Solo and Lazer Gun

There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each sto

原创 【CodeForces - 288C】Polo the Penguin and XOR operation (思維、異或運算)

Little penguin Polo likes permutations. But most of all he likes permutations of integers from 0 to n, inclusive. For p

原创 【nowcoder】出裝方案(二分圖匹配/最小費用最大流)

題目鏈接 鏈接:https://ac.nowcoder.com/acm/contest/283/F 來源:牛客網   時間限制:C/C++ 1秒,其他語言2秒 空間限制:C/C++ 32768K,其他語言65536K 64bit IO F

原创 【SPOJ - SCITIES】Selfish Cities(最小費用最大流)

Far, far away there is a world known as Selfishland because of the nature of its inhabitants. Hard times have forced th

原创 【POJ - 2135】Farm Tour(最小費用最大流)

When FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 <= N <= 1000) fields num

原创 【CodeForces - 76D】Plus and xor(位運算-異或)

Bitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exc

原创 【nyoj-127】星際之門(一)(Cayley公式 / Prufer序列)

星際之門(一) 時間限制:3000 ms  |  內存限制:65535 KB 難度:3 描述 公元3000年,子虛帝國統領着N個星系,原先它們是靠近光束飛船來進行旅行的,近來,X博士發明了星際之門,它利用蟲洞技術,一條蟲洞可以連通任意的兩

原创 【CodeForces - 266C】Below the Diagonal(模擬)

You are given a square matrix consisting of n rows and n columns. We assume that the rows are numbered from 1 to n from

原创 【HDU - 2376】Average distance (樹上任意兩點之間的距離之和的平均值、計算結點的貢獻度)

Given a tree, calculate the average distance between two vertices in the tree. For example, the average distance betwee

原创 【POJ - 3342】Party at Hali-Bula (樹形dp+判斷)

Dear Contestant, I'm going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could

原创 【POJ - 1655】Balancing Act (樹的重心)

Consider a tree T with N (1 <= N <= 20,000) nodes numbered 1...N. Deleting any node from the tree yields a forest: a co