原创 Kattis - 2048

2048 is a single-player puzzle game created by Gabriele Cirulli1. It is played on a 4×44×4 grid that contains integers 

原创 Tree(HDOJ-2682)

今天還是複習圖論。 一道最小生成樹的題目,題目其實不難。 但一開始邊的數目用的是MAXN*MAXN/2,MLE了一次,換vector之後不斷地WA……結果上來看是因爲沒有用素數篩法,之前用的是這樣的一個單獨判斷一個數是否是素數

原创 Slots of Fun

The International Betting Machine company has just issued a new type of slot machine. The machine display consists

原创 小希的迷宮(HDOJ-1272)

Problem Description 上次Gardon的迷宮城堡小希玩了很久(見Problem B),現在她也想設計一個迷宮讓Gardon來走。但是她設計迷宮的思路不一樣,首先她認爲所有的通道都應該是雙向連通的,就是說如果有一個

原创 Dice Notation (ZOJ-3930)

Time Limit: 2 Seconds      Memory Limit: 65536 KB...<Saika> I want to get some water from this strange lake. I have a b

原创 Fire Game(FZU - 2150)

Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginn

原创 Seven-Segment Display(ZOJ - 3954)

Time Limit: 1 Second      Memory Limit: 65536 KBA seven segment display, or seven segment indicator, is a form of elect

原创 How Many Nines(ZOJ - 3950)

Time Limit: 1 Second      Memory Limit: 65536 KBIf we represent a date in the format YYYY-MM-DD (for example, 2017-04-0

原创 Ignatius and the Princess I(HDOJ-1026)

Problem Description The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our p

原创 Huge Mission(FOJ-1608)

Oaiei is busy working with his graduation design recently. If he can not complete it before the end of the month, a

原创 Reward(HDOJ-2647)

Problem Description Dandelion’s uncle is a boss of a factory. As the spring festival is coming , he wants to distri

原创 7-3 列出連通集(25 分)

給定一個有N個頂點和E條邊的無向圖,請用DFS和BFS分別列出其所有的連通集。假設頂點從0到N−1編號。進行搜索時,假設我們總是從編號最小的頂點出發,按編號遞增的順序訪問鄰接點。輸入格式:輸入第1行給出2個整數N(0<N≤10)和E,分別

原创 Skiing(POJ - 3037)

Bessie and the rest of Farmer John’s cows are taking a trip this winter to go skiing. One day Bessie finds herself

原创 String Successor(ZOJ - 3490 )

The successor to a string can be calculated by applying the following rules: Ignore the nonalphanumerics unless there a

原创 7-1 列出葉結點(25 分)

7-1 列出葉結點(25 分)對於給定的二叉樹,本題要求你按從上到下、從左到右的順序輸出其所有葉節點。輸入格式:首先第一行給出一個正整數 N(≤10),爲樹中結點總數。樹中的結點從 0 到 N−1 編號。隨後 N 行,每行給出一個對應結點