原创 Servlet採用forward出現中文亂碼問題解決
經常有人問到,在servlet裏面forward到一個頁面之後,瀏覽器總是漢字的亂碼。經調試發現,是由於在servlet裏面不能正確調用 response.getWriter()方法造成的。 servlet 如下,如果去掉註釋,則會出現
原创 hdu 4318 SPFA 最短路
AC code: #include<iostream> #include<stdio.h> #include<queue> #include<iomanip> #include<string> #include<cstring> usin
原创 漢諾塔棧的簡單應用 nyoj93
鏈接:http://acm.nyist.net/JudgeOnline/problem.php?pid=93 利用棧來模擬過程: AC code: #include <iostream> #include <stack> using na
原创 前綴表達式的計算
//nyoj 128前綴表達式 #include <iostream> #include<stdio.h>#include <sstream> #include <iomanip> #include <cstring> #include
原创 雙循環鏈表之分離
要求: 把a1,a2,a3,a4,....an分離成 a1,a3,a5,....an,..a4,a2; 代碼如下: //雙循環鏈表 //帶頭結點的循環鏈表 #include <iostream> using namespace std;
原创 單鏈表
#include <iostream> using namespace std; typedef int ElemType; typedef struct Node { ElemType data; Node *next; }List
原创 hdu 2545
鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=2545 並查集解決. AC code: #include <iostream> #include <stdio.h> using namespac
原创 hdu1381
鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1381 題意中的NC不懂有什麼用...用的STL裏面的map過的. AC code: #include <iostream> #include <
原创 hdu 1272
鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1272 2個條件: 1,用並查集判斷是否有環. 2, 在一根樹中. AC code: #include <iostream> using nam
原创 STL排序
0 前言: STL,爲什麼你必須掌握 對於程序員來說,數據結構是必修的一門課。從查找到排序,從鏈表到二叉樹,幾乎所有的算法和原理都需要理解,理解不了也要死記硬背下來。幸運的是這些理論 都已經比較成熟,算法也基本固定下來,不需要你再去花
原创 poj 3461
鏈接:http://poj.org/problem?id=3461 KMP: AC code: #include<iostream> #include<cstring> #include<stdio.h> using namespace
原创 hdu 1811
鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1811 ps:輸入格式看錯了,提交了好幾次。。原來中間還有空格。。 自從Lele開發了Rating系統,他的Tetris事業更是如虎添翼,不久
原创 hdu2716
#include <iostream> #include <cstring> #include "stdio.h" using namespace std; int main() { char str1[26],str2[81]; w
原创 STL 堆操作
需要頭文件 #include<algorithm> 常用的三個函數 make_heap(),pop_heap(),push_heap(),sort_heap(). make_heap() 函數原型: void make_heap(fir
原创 hdu1829 A Bug's Life
鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1829 題意:判斷一些類似男女配對數據裏是否存在同性戀,用並查集判斷是否存在同性戀,即同一集合裏面是同性的人,增加輔助數組判斷性別. Ac cod