DescriptionThe public transport administration of Ekaterinburg is anxious about the fact that passengers don't like to pay for passage doing their best to avoid the fee. All the measures that had been taken (hard currency premiums for all of the
//圖的遍曆//CITY記錄到當前城市的的最大運載量//狀態轉移方程,city[y] = max(city[y],min(r[x->y],city[x]);#include<iostream>#include<map>#include<string>#include<queue>using namespace std;const int MAX = 205;const int MAXM = 40000;const int INF = 1000
DescriptionStandard web browsers contain features to move backward and forward among the pages recently visited. One way to implement these features is to use two stacks to keep track of the pages that can be reached by moving backward and forward.
//拓撲排序,若a員工工資比b員工多,那麼從b->a建立有向邊//接著從工資應該最小的員工開始逐步向工資最大的員工疊加//注意對DAG環的判斷//注意因為結點數高達10000,因此必須用鄰接表儲存#include<iostream>#include<vector>#include<cstring>#include<queue>using namespace std;const int MAX = 10005;vector<int>
MasterMind is a game for two players. One of them, Designer, selects a secret code. The other, Breaker, tries to break it. A code is no more than a row of colored dots. At the beginning of a game, the players agree upon the length N that a code must
摘自馮威論文——《數與圖的完美結合》設num[ i ]為i時刻能夠開始工作的人數,x[ i ]為實際僱傭的人數,那麼x[ I ]<=num[ I ]。 設r[ i ]為i時刻至少需要工作的人數,於是有如下關係: x[ I-7 ]+x[ I-6 ]+x[ I-5 ]+x[ I-4]+x[ I-3 ]+x[ I-2 ]+x[ I-1 ]+x[ I ]>=r[ I ] 設s[ I ]=x[ 1 ]+x[ 2 ]…+x[ I ],得到 0<=s[ I ]-s[ I-1