原创 UVA1347---Tour(dp,雙調TSP)

dp[i][j] 表示在1~max(i,j)都已經被走過的情況下,第一個人在i點,第二個人在j點時,走完剩下的點還需要的最短距離 規定第一個人領先第二個人 所以dp[i][j] 可以轉移到dp[i+1][j] 和dp[i+1]

原创 hdu5248---序列變換(二分答案+貪心)

先二分答案,然後從後往前貪心就行 /************************************************************************* > File Name: hdu524

原创 hdu5245---Joyful(期望)

Problem Description Sakura has a very magical tool to paint walls. One day, kAc asked Sakura to paint a wall that

原创 LightOJ1408---Batting Practice (期望,推公式)

After being all out for 58 and 78 in two matches in the most prestigious tournament in the world, the coach of a ce

原创 UVA1025---A Spy in the Metro(簡單dp)

dp[i][j] 表示時刻i,在車站j,等待的最少時間 有3種方案: 等一分鐘 往左搭車 往右搭車 /************************************************************

原创 hdu1796---How many integers can you find(容斥原理)

容斥入門題 計算同時被1個數整除的,減去同時被2個整除,加上同時被3個整除的…. 被多個數同時整除,就是被這些數的lcm整除,注意0 /*********************************************

原创 ZOJ2836---Number Puzzle(容斥原理)

Given a list of integers (A1, A2, …, An), and a positive integer M, please find the number of positive integers tha

原创 hdu5249---KPI(二分+樹狀數組)

Problem Description 你工作以後, KPI 就是你的全部了. 我開發了一個服務,取得了很大的知名度。數十億的請求被推到一個大管道後同時服務從管頭拉取請求。讓我們來定義每個請求都有一個重要值。我的KPI是由當前管

原创 hdu4059---The Boss on Mars(容斥原理+前n項的4次方和)

Problem Description On Mars, there is a huge company called ACM (A huge Company on Mars), and it’s owned by a youn

原创 hdu4825---Xor Sum(Trie + 貪心)

Problem Description Zeus 和 Prometheus 做了一個遊戲,Prometheus 給 Zeus 一個集合,集合中包含了N個正整數,隨後 Prometheus 將向 Zeus 發起M次詢問,每次詢問中

原创 Codeforces Round #240 (Div. 1)---B.Mashmokh and ACM(dp)

Mashmokh’s boss, Bimokh, didn’t like Mashmokh. So he fired him. Mashmokh decided to go to university and participat

原创 Codeforces Round #305 (Div. 2)D---Mike and Feet(單調棧)

Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of

原创 POJ1337---A Lazy Worker(dp)

Description There is a worker who may lack the motivation to perform at his peak level of efficiency because he is

原创 UVA12186--- Another Crisis (樹形dp)

Description Download as PDF A couple of years ago, a new world wide crisis started, leaving many people with econo

原创 hdu5246---超級賽亞ACMer(貪心)

Problem Description 百小度是一個ACMer,也是一個超級賽亞人,每個ACMer都有一個戰鬥力,包括百小度。
所謂超級賽亞人的定義,是說如果在對抗中剛好接近極限狀態,那就會激發鬥志,實力提升. 具體來說,就是百