Time of Update: 2014-07-27
標籤:寫出一個較好的快速排序程式快速排序是常用的排序演算法之一,但要想寫出一個又快又準的使用程式,就不是那麼簡單了需要注意的事項首先要寫正確。通常使用遞迴實現。其遞迴相當於二叉樹展開,因此如果要用迭代實現的話需要使用一個隊列來儲存後續遍曆資訊。快速排序需要找到一個pivot值,如果順序選擇pivot則易造成N^2的複雜度,如果使用隨機數則效果最好,但開銷又太大,採取三數中值法比較合適。三數中值法指的是選取第一個值,最後一個值,
Time of Update: 2014-07-27
標籤:解題報告http://blog.csdn.net/juncoder/article/details/38160591題目傳送門題意:求滿足條件的最大集合:集合內任何兩個人都沒有浪漫關係思路:跟POJ2771一樣的題,變的簡單多了。POJ2771解題報告#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace
Time of Update: 2014-07-27
標籤:poj 演算法 algorithm 一個N*N(1<=N<=1000)的矩陣,從(1,1)開始,給定一些操作C和一些查詢Q,一共K條(1<=K<=50000):C x1,y1,x2,y2 表示從x1行y1列到x2行y2列的元素全部反轉(0變成1,1變成0);Q x
Time of Update: 2014-07-27
標籤:用了和3Sum差不多一樣的思路,二分尋找。關鍵要剪枝,但是卻在剪枝那裡犯了很多錯誤。然後原來有一個更加快的思路O(n^2).#include<iostream> #include <vector> #include <algorithm> #include <math.h>using namespace std;class Solution {public:int threeSumClosest(vector<int>
Time of Update: 2014-07-27
標籤: 我的需求的,文章要選擇封面,用尋找帶回實現,看了尋找帶回函數bringBack的代碼發現,都是針對input 標籤處理的,所以img標籤始終不能顯示,所以對dwz的原始碼做了修改,在dwz.databases.js 中找到函數bringBackSuggest,增加代碼如下代碼即可:$box.find(":img").each(function(){var $input = $(this), inputName =
Time of Update: 2014-07-27
標籤:勝利大逃亡 Time Limit : 4000/2000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 15 Accepted Submission(s) : 7Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem
Time of Update: 2014-07-27
標籤:四、建立者模式1.>機車組裝系統覺得這些例子挺適合入門的,容易理解,看了之後大概是個什麼樣子的就有了印象。>機車 = 車架 + 車輪 + 輪胎 + 發動機。首先設計>機車類以及各零件類:>機車類:public interface Motorcycle{ void build();}public class Motorcycle1 implements Motorcycle{ void build(){
Time of Update: 2014-07-27
標籤:BestCoder Round #1資料不大#include<bits.stdc++.h>using namespace std;vector<int>vec[100020];int f[100020];int main(){int T,n,m,a,b,cmd,Q,u,v;scanf("%d",&T);for(int kase=1;kase<=T;kase++){ scanf("%d%d",&n,&
Time of Update: 2014-07-27
標籤:cocos2d-x 手遊 cocos2d-x 3.0
Time of Update: 2014-07-27
標籤:基本的字串處理轉換。噴一噴HDU這個超級垃圾的判斷系統:如果把數字存入字串數組中輸出就會錯誤。如:A2B3C,如果其中的2和3儲存如字串數組中,然後輸出那麼就判斷為WA,必須是即時輸出數字2和3才算正確。這樣判我WA,哎, HDU做好點你們的判斷系統吧。#include <string>#include <iostream>using namespace std;int main(){int T;string s;scanf("%d",
Time of Update: 2014-07-27
標籤:move "c:\Documents and Settings\leon\Application Data\Mozilla\Firefox\Profiles\eyr6cp34.default\sessionstore.bak" "c:\Documents and Settings\leon\Application Data\Mozilla\Firefox\Profiles\eyr6cp34.default\sessionstore.bak.%date:~0,4
Time of Update: 2014-07-27
標籤:acm 置換 Cow SortingTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5946 Accepted: 2263DescriptionFarmer John‘s N (1 ≤ N ≤ 10,000) cows are lined up to be
Time of Update: 2014-07-27
標籤:A計劃Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9162 Accepted Submission(s): 2208Problem Description可憐的公主在一次次被魔王擄走一次次被騎士們救回來之後,而今,不幸的她再一次面臨生命的考驗。
Time of Update: 2014-07-27
標籤:本設計模式就是利用不同的類包起不同的命令,達到使用什麼命令就實現什麼操作。也可以進一步利用map和自己喜歡的命令詞對接起來。一個執行類實際上已經包含了所有需要的操作了,如:class SuperMaker{public:string makeCar(){return "Car";}string makePlane(){return "Plane";}};這裡有兩個命令,下面要做的就是使用不同的類把需要的命令包含起來。class
Time of Update: 2014-07-27
標籤:hdu1207漢諾塔IITime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4799 Accepted Submission(s): 2362Problem
Time of Update: 2014-07-27
標籤:下面開始讀具體源碼config.h檔案/* * Struck: Structured Output Tracking with Kernels * * Code to accompany the paper: * Struck: Structured Output Tracking with Kernels * Sam Hare, Amir Saffari, Philip H. S. Torr * International Conference on Computer
Time of Update: 2014-07-27
標籤:進程模型 Nginx分為Single和Master兩種進程模型,Single模型即為單進程方式工作,具有較差的容錯能力,不適合生產之用。Master模型即為一個master進程+N個worker進程的工作方式。生產環境都是用master-worker模型來工作。master進程
Time of Update: 2014-07-27
標籤:狀態壓縮DPdp[i][j]表示在i狀態(用二進位表示城市有沒有經過)時最後到達j城市的最小時間轉移方程dp[i][j]=min(dp[i][k]+d[k][j],dp[i][j]) d[k][j]是k城市到j城市的最短距離 要先用flody處理#include<bits.stdc++.h>using namespace std;int d[20][20],dp[1<<11][20];int n,m;void flody(){for(int k=
Time of Update: 2014-07-27
標籤:c++Problem
Time of Update: 2014-07-27
標籤:DescriptionEvery time it rains on Farmer John‘s fields, a pond forms over Bessie‘s favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Farmer John has built a set of