原创 HDOJ 4054 Hexadecimal View

~~~題目鏈接~~~ 思路:模擬 #include <stdio.h> #include <string.h> int len = 0; char str[5002]; void print(int cur) { int i

原创 HDOJ 4119 Isabella's Message

~~~題目鏈接~~~ 題目大意:給出一個N*N的矩陣,上面有些空格寫有字母有些爲空格, 現在給你一張N*N解密的卡片(卡片上面有N*N/4個洞),現在把卡片放在有字的矩陣上(初始方向不定),通過洞可以看到字母, 然後旋轉卡片90度,又可以

原创 HDOJ 1856 More is better

~~~題目鏈接~~~ code: #include <stdio.h> #define N 10000002 int min = 0, max = 0, r[N], f[N]; void init() { for(int i =

原创 HDOJ 1879 繼續暢通工程

~~~題目鏈接~~~ code: #include <stdio.h> #include <algorithm> using namespace std; class node { public: int x,

原创 UVa 12291 Polyomino Composer

~~~題目鏈接~~~ 題目大意:給出一個圖形,現要你判斷 它是不是由2個基本圖形(不能旋轉))組合成的。 Ps:開始用遞歸進行模擬, 老是超時, 還是用隊友的方法過吧。 code: #include <iostream> #inc

原创 HDOJ 1262 尋找素數對

~~~題目鏈接~~~ 水過 #include <stdio.h> #include <string.h> int main() { int i = 0, j = 0, sum = 0, p[10002] = {0};

原创 CF 4B Before an Exam

~~~題目鏈接~~~ 題目大意:現有d個區間, 現在在每個區間中選一個數,使得總和等於他給定的一個數。 思路:先把每個區間的最小值選了, 在遍歷每個區間, 如果當前這個區間的最大值選了還不能組合成sumTime,就選最大的數, 否則就

原创 POJ 2104 K-th Number (劃分樹)

~~~題目鏈接~~~ 題目大意:給出n個數,現在要求求出區間中的第k大值 思路:劃分樹模版 #include <cstdio> #include <algorithm> #define N 100002 using namesp

原创 HDOJ 1875 暢通工程再續

~~~題目鏈接~~~ code: #include <stdio.h> #include <math.h> #include <algorithm> using namespace std; struct node1 { int

原创 HDOJ 1754 I Hate It

~~~題目鏈接~~~ ps:這題數據太水了, 看以前錯的代碼都能過, 改了下應該是對的了。 #include <stdio.h> #include <string.h> #define N 2000002 #define max(

原创 CF 4D Mysterious Present

~~~題目鏈接~~~ 題目大意:先給出一張卡片的長和寬, 現在有n張信封, 每張信封都有一定的長和寬, 現在要求從這些信封中選出最多信封, 從左到右排列, 右邊的信封的長寬都分別大於左邊的, 且卡片能裝入最左邊的信封中。 思路:對信封

原创 CF 4A Watermelon

~~~題目鏈接~~~ code: #include <iostream> using namespace std; int main() { int i = 0, j = 0, w = 0, flag = 0; whi

原创 Vijos P1033 家族

~~~題目鏈接~~~ 水果~ #include <cstdio> #define N 5002 using namespace std; int n = 0, m = 0, p = 0, father[N], rank[N]; i

原创 HDOJ 1232 暢通工程

~~~題目鏈接~~~ code: #include <stdio.h> #define N 1002 int n = 0, m = 0, r[N], f[N]; void init(int n) { for(int i = 0;

原创 HDOJ 1272 小希的迷宮

~~~題目鏈接~~~ code: #include <stdio.h> #define N 100002 int flag = 0, max = 0, num[N], rank[N], father[N]; void init() {