原创 1039. Phone Home

Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description When relay towers for mobile telephones communicate wi

原创 Rails

The local tradition is that every train arriving from the direction A continues in the direction B with coaches reorg

原创 1114. Food Cubes

One spaceman places several food cubes in space such that there may be holes between cubes. Others, gi

原创 1351. Multi-key Sorting

    一開始沒有仔考慮,認爲去掉重複的就好了,所以就從前往後遍歷,將重複的標記,最後直接輸出沒有標記過的數字。    當然時錯的,看了下別人的思路沒看懂,但是代碼都是從後往前遍歷。之後突然想到題目中說的stable, 對於某個K值的so

原创 1280. Permutation

#include<iostream> #include<cstring> using namespace std; const int MAX = 105; int dp[MAX][MAX]; int array[MAX]; int ma

原创 1934. 移動小球

Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description 你有一些小球,從左到右依次編號爲1,2,3,...,n. 你可以執行兩種指令(1或者2)。其中, 1 X

原创 1156. Binary tree

題目要求:輸入n行 每行四個數據,分別代表id, 數據, 左孩子和又孩子,id範圍是1~1000,數據爲大寫字母 思路如下:建立四個數組,可以看作一個節點, 數組下標用來表示id, 四個數組分別存放當前下標節點的數據、左孩子id,右孩子i