原创 URAL 1156 Two Rounds (DFS二分染色 + DFS枚舉 + 剪枝)

#include <stdio.h> #define MAX 110 int numOfTasks, numOfPairs; int numOfProblems; typedef struct Node{ int to; int n

原创 URAL 1039 Anniversary Party (樹形DP)

#include <stdio.h> #define MAX_EMPLOYEES 6000 #define MAX(x, y) ( (x) > (y) ? (x) : (y) ) int numOfEmployees; int conv

原创 POJ 1734 Sightseeing Trip (最小環)

#include <stdio.h> #define MAX_POINTS 101 #define INF 300000 int numOfPoints, numOfRoads; int initialDist[MAX_POINTS][

原创 USACO 3.1 Score Inflation (完全揹包)

#include <stdio.h> #define DEBUG 1 #define TESTCASES 9 #define MAX 10000 int contestMinutes, numOfClasses; int pointAr

原创 POJ 1125 Stockbroker Grapevine (FloydWarshall 所有點對最短路徑)

#include <stdio.h> #define MAX_STOCKBROKERS 101 //10 minutes * 100 stockBrokers + 1 #define MAX_MINUTES 1001 int numOf

原创 POJ 3253 Fence Repair (霍夫曼編碼 + 最小堆)

#include <stdio.h> #define MAX_PLANKS 20000 int numOfPlanks; long long length[MAX_PLANKS + 1]; int heapSize; void swa

原创 URAL 1221 Malevich Strikes Back! (DP動態規劃 O(n^2) )

#include <stdio.h> #define MAX_SIZE 101 #define MIN(x, y) ( (x) < (y) ? (x) : (y) ) int paper[MAX_SIZE][MAX_SIZE]; //存儲

原创 URAL 1156 Two Rounds (DFS二分染色 + 分組揹包)

#include <stdio.h> #define MAX 110 int numOfTasks, numOfPairs; int numOfProblems; typedef struct Node{ int to; int n

原创 二分搜索

#include <stdio.h> /*V0版本是原生的二分搜索*/ int binarySearch_V0(int sortedArray[], int size, int value){ int first = 0; int

原创 POJ 2623 Crashing Robots

#include <stdio.h> #define MAX 101 int testCases; int xLen, yLen; int occupied[MAX][MAX]; int numOfRobots, numOfInstru

原创 Init進程啓動Zygote進程的過程

Android系統啓動時在加載完內核之後會啓動Init進程,Init進程的啓動過程中會讀取根目錄下的腳本文件Init.rc,以便將Zygote進程啓動起來。 //Android系統在加載內核之後會啓動init進程,以下爲Init進程的m

原创 《編程之美》 求二進制數中1的個數

#include <stdio.h> //常規解法,求餘運算比較耗時可優化 int countV1(int num){ int result = 0; while (num){ if (num % 2) result++;

原创 HDU 1712 ACboy needs your help (分組揹包)

#include <stdio.h> #define MAX 101 int numOfCourses, mostDays; int profit[MAX][MAX]; int maxProfit[MAX]; int main(){

原创 USACO 3.1 Stamps

#include <stdio.h> #define DEBUG 1 #define TESTCASES 9 #define MAX_VALUES 50 #define MAX_TOTALVALUE 2000000 int valueA

原创 Android UI 的單位和概念

1. px Pixels,像素,1px代表屏幕一個物理像素點。 2. resolution Resolution,分辨率,在屏幕上顯示的物理像素的總和,寬×高表示。 3. density Density,單位屏幕面積上顯示的像素數量。 4