原创 HDU1874 (dijkstral算法)

居然有重邊..... 有重邊也就罷了居然可以起點和終點一樣!! 1:重邊選擇最小的; 2:起點和終點相同的時候輸出0. 這樣就行了. #include <stdio.h> #include <string.h> #define MAX

原创 HDU1398 (母函數)

模板直接用用.... #include<stdio.h> #include<string.h> int money[17]; int c1[3000],c2[3000]; void init() { int i; money[0] =

原创 Android Toast&Notification(Part I)

雖然聲明是原創,但是大部分代碼和思路還是來自互聯網,這裏加上自己的總結。源代碼在這裏下載 在android中,Toast經常被用來當作應用程序反饋的操作,Toast出現的時候當前的程序界面仍然處於可見 狀態並且可以和用戶交互。 1、最

原创 HDU2037--貪心入門

簡單的貪心...還是貪心的題目好啊. #include<stdio.h> #include<stdlib.h> typedef struct task { int begin; int end; }task; task s[400];

原创 hdu1517 小小的博弈

  只要記住2 和 9 交替出現就行了(當然 n==2 n==9 的時候例外) 下面的說明來自:http://blog.sina.com.cn/s/blog_67e7f5fa0100ij5o.html 這題其實不是求必敗點,必勝點,而

原创 HDU1053--哈夫曼樹

#include<stdio.h> #include<stdlib.h> #include<string.h> struct { int data; int papa; }arr[1000]; int

原创 HDU1159 最長公共子序列

http://acm.hdu.edu.cn/showproblem.php?pid=1159   我要dpdpdpdpdpdpdp 比較害怕動態規劃的題目,狀態轉移方程經常找不到,比如這一題我還是畫出表格纔想出來的. 作爲小菜鳥一枚也只

原创 HDU1087 最長上升子序列加強版

//http://acm.hdu.edu.cn/showproblem.php?pid=1087 /* 第一眼感覺是動態規劃,但是時間複雜度還是很高的O(n*n)啊. */ #include <stdio.h> #include <s

原创 hdu 1392 凸包問題

  凸包算法來自於:http://blog.csdn.net/fivedoumi/article/details/7653128 當  n==2 的時候要特殊考慮; #include<stdio.h> #include<stdlib.h>

原创 HDU1150-- Machine Schedule( 二分圖最小頂點覆蓋)

  當做模板來用吧.. #include<stdio.h> #include<string.h> int n1,n2,m,ans; int result[1005]; int state[1005]; int maps[1005][10

原创 hdu 1078 動態規劃

記憶化搜索是什麼東西??? #include<stdio.h> #include<stdlib.h> #include<string.h> #define maxn(a,b) a>b?a:b int path[101][101]; int

原创 素數打表

//高效率的打表看不懂..來個簡單的模板 void init_prime() { int i, j; for(i = 2;i <= sqrt(1000002.0); ++i) { if(!prime[i]) for(j =

原创 HDU1028 (母函數模板)

#include <iostream> using namespace std; const int _max = 10001; int c1[_max], c2[_max]; int main() { int nNum;

原创 HDU1086--線段相交

當模板來用.. #include<stdio.h> #include<math.h> #define TRUE 1 #define FALSE 0 typedef struct node { double x,y; }node; no

原创 HDU 1142--動規

最短路徑很好寫,但是動態規劃就..... 還是借鑑瞭解題報告. #include<stdio.h> #include<stdlib.h> #include<string.h> #define number 1005 #def