原创 猜近似數字( PTA 520鑽石爭霸賽 )

甲想好了一個 n 位數字讓乙來猜,只要猜的數字位數正確,至多有 1 位與謎底不同,且不同的數字相差不超過 1,就算猜對了。例如謎底是 67,若乙猜 66、68、77、57,就都算對了;猜 167 就不能算對。 輸入格式: 輸入首先

原创 Goldbach`s Conjecture LightOJ - 1259(素數打表)

Goldbach’s conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:

原创 The number of divisors(約數) about Humble Numbers HDU - 1492 (唯一分解定理)

A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9,

原创 Spell checker(字符串處理)

You, as a member of a development team for a new spell checking program, are to write a module that will check the

原创 N!Again HDU - 2674

WhereIsHeroFrom: Zty, what are you doing ? Zty: I want to calculate

原创 Card Game Cheater HDU - 1962 (二分圖匹配)

Adam and Eve play a card game using a regular deck of 52 cards. The rules are simple. The players sit on opposite s

原创 [NOIP2013]轉圈遊戲 計蒜客 - T2013 (快速冪)

n 個小夥伴(編號從 0 到 n−1)圍坐一圈玩遊戲。按照順時針方向給 n個位置編號,從 0 到 n−1。最初,第 0 號小夥伴在第 0 號位置,第 1 號小夥伴在第 1號位置,……,依此類推。 遊戲規則如下:每一輪第 0 號位置

原创 Knight Moves UVA - 439 (廣搜 + 隊列)

A friend of you is doing research on theTraveling Knight Problem (TKP)where you are to find theshortest closed tour

原创 威佐夫遊戲 51Nod - 1072 (威佐夫博弈)

有一堆石子共有N個。A B兩個人輪流拿,A先拿。每次最少拿1顆,最多拿K顆,拿到最後1顆石子的人獲勝。假設A B都非常聰明,拿石子的過程中不會出現失誤。給出N和K,問最後誰能贏得比賽。 例如N = 3,K = 2。無論A如何拿,B

原创 Max Sum HDU - 1003(最大子序列和)

Given a sequence a[1],a[2],a[3]…a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6

原创 繼續暢通工程 HDU - 1879(暢通路程3.0)

省政府“暢通工程”的目標是使全省任何兩個村莊間都可以實現公路交通(但不一定有直接的公路相連,只要能間接通過公路可達即可)。現得到城鎮道路統計表,表中列出了任意兩城鎮間修建道路的費用,以及該道路是否已經修通的狀態。現請你編寫程序,計

原创 Good Numbers (hard version) CodeForces - 1249C2

The only difference between easy and hard versions is the maximum value of n. You are given a positive integer numb

原创 Ice_cream's world I HDU - 2120 (並查集)

ice_cream’s world is a rich country, it has many fertile lands. Today, the queen of ice_cream wants award land to d

原创 確定比賽名次 HDU - 1285 (拓撲排序)

有N個比賽隊(1<=N<=500),編號依次爲1,2,3,。。。。,N進行比賽,比賽結束後,裁判委員會要將所有參賽隊伍從前往後依次排名,但現在裁判委員會不能直接獲得每個隊的比賽成績,只知道每場比賽的結果,即P1贏P2,用P1,P2

原创 Prime Time UVA - 10200 (打表+高精度陷阱)

Euler is a well-known matematician, and, among many other things, he discovered that the formulan2+n+ 41 produces a