原创 Marked Ancestor Aizu - 2170

題目: Problem F: You are given a tree T that consists of N nodes. Each node is numbered from 1 to N, and node 1 is always

原创 Bad Cowtractors POJ - 2377(Kruskal算法+最大生成樹)

題目: Bessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns that are conv

原创 Drying POJ - 3104(二分搜索)

題目: It is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is not afraid o

原创 Agri-Net POJ - 1258

題目: Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to

原创 Raising Modulo Numbers POJ - 1995

題目: People are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in

原创 Face The Right Way POJ - 3276

題目: Farmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, like good cows. S

原创 Find them, Catch them POJ - 1703

題目: The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the

原创 Out of Hay POJ - 2395 (最小生成樹)

題目: The cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends to visit the other

原创 Six Degrees of Cowvin Bacon POJ - 2139

題目: The cows have been making movies lately, so they are ready to play a variant of the famous game "Six Degrees of Kev

原创 Monthly Expense POJ - 3273 (二分搜索枚舉判斷)

題目: Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has a

原创 Cow Acrobats POJ - 3045

題目: Description Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. T

原创 Silver Cow Party POJ - 3268

題目: One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be h

原创 Pseudoprime numbers POJ - 3641

題目: Fermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise

原创 Jessica's Reading Problem POJ - 3320

題目: Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she h

原创 最短路徑算法

前言: 最短路徑算法:用於計算一個節點到其他所有節點的最短路徑。主要特點是以起始點爲中心向外層層擴展,直到擴展到終點爲止。 例子: 暑期,你想要出門去旅遊,但是在你出發之前,你想知道任意兩個城市之間的最短距離。 給出地圖: