Time of Update: 2013-11-08
去年多校的時候用最暴力的辦法水過了,忽然看到,覺得還是得用正統的方式過了.............#include <iostream>#include <algorithm>#include <cmath>#include<functional>#include <cstdio>#include <cstdlib>#include <cstring>#include
Time of Update: 2013-11-08
題意:給出密碼做的現狀和密碼, 每次可以移動連續的最多3列, 向上或向下, 求將密碼調出來所需要的最少步數.思路:首先應看出,恢複的過程中, 調每一位的時間順序是不影響的, 不妨就從左至右一位位消除.dp[ i ][ x ][ y ] 表示前 i 位已經消除為0, 且其後的兩位為x,y時, 所需要的最小運算元.每次可以旋轉1~3位, 注意旋轉3位時, 第三位和第二位的約束關係.[因此而wa了...]和Wordstack那道題的"題解版"的思路相同,
Time of Update: 2013-11-08
#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int maxn=5e1+9,inf=1e9;char a[maxn][maxn],now[maxn][maxn];int dist[maxn][maxn],d[maxn][maxn],quex[1111111],quey[1111111];int n,m;void init(){
Time of Update: 2013-11-08
傳送門:http://acm.hdu.edu.cn/showproblem.php?pid=2485題意:給你n個點,m條相連的邊,問你最少去掉幾個點使從1到n最小路徑>=k,其中不能去掉1,n兩個點。題解:這個題目可以用最小流解決,也可以用IDA* + BFS解決。AC代碼:#include <iostream>#include <cstdio>#include <cstring>#include <string&
Time of Update: 2013-11-08
一組測試資料得到的結果8 8 33 34 56 62 17 7最短路徑 1 :(2, 1) (3, 1) (4, 1) (5, 1) (6, 1) (7, 1) (7, 2) (7, 3) (7, 4) (7, 5) (7, 6) (7, 7)最短路徑 2 :(2, 1) (3, 1) (4, 1) (5, 1) (6, 1) (6, 2) (7, 2) (7, 3) (7, 4) (7, 5) (7, 6) (7,
Time of Update: 2013-11-08
在C++中,一般定義一個對象之後,我們最好是能夠將其初始化,使他有一個確定的初始狀態,這樣能避免很多不確定因素,那麼在C++中是如何做的呢?這時候就需要引入建構函式的概念了。一、所謂建構函式C++中的類可以定義和類名相同的特殊成員函數,這種函數就叫做建構函式。注意:定義建構函式的時候可以有參數的,但是定義的建構函式不能有返回值的但是,但是在建構函式中是可以有return語句的。舉個例子:#include
Time of Update: 2013-11-08
前言前幾天博主在新浪微薄上看到耗子叔叔考察了atoi的編寫,周四博主也要面試阿里(ps:雖然博主LNMP方向,但是還是有信心拼一把),這裡也自己實現一下這兩個函數,防止面試問到答不出來atoi#include <stdio.h>#include <stdlib.h>#define INT_MAX 2147483647#define INT_MIN -2147483648int myatoi(const char *s){int val, flag;unsigned
Time of Update: 2013-11-08
簡單題目。。/*簡單的bfs*/#include<algorithm>#include<iostream>#include<string.h>#include<stdlib.h>#include<stdio.h>#include<math.h>#include<queue>#include<stack>#include<map>#include<set>using
Time of Update: 2013-11-08
題目點這:http://uva.onlinejudge.org/external/1/160.pdf思路:遍曆1~n計算質因子個數即可。你若還想再快點的話,就用[n/p]+[n/p^2]+[n/p^3]+...+1在O(log n/log
Time of Update: 2013-11-08
Java異常處理 Java的基本理念是“”--Thinking in Java。 Java中的異常處理是一種在編譯階段的錯誤報表機制,是通過編譯器強制執行的。不過尚須明白的是:編譯期間並不能找出所有的錯誤,餘下的問題必須在運行期間解決。 &
Time of Update: 2013-11-08
// 找出兩個數組的共同元素int* FindCommon(int* a, int* b, int nA, int nB, int& nOut){ int i = 0; int j = 0 ;vector<int> vec_comm;int* output = NULL; while (i < nA && j < nB) { if (a[i] < b[j]) ++i
Time of Update: 2013-11-08
一、首先啟動qt creator二、點擊 *.ui檔案 進入UI設計三、設定按鈕響應 在大括弧內,填寫需要做出的響應,這裡就簡單寫個退出吧:void MainWindow::on_pushButton_2_clicked(){ exit(0);}
Time of Update: 2013-11-08
該文章主要是通過C#網路編程的webBrowser擷取網頁中的url並簡單的嘗試瞎子啊網頁中的圖片,主要是為以後網路開發的基礎學習.其中主要的通過應用程式結合網頁知識、Regex實現瀏覽、擷取url、下載圖片三個功能.而且很清晰的解析了每一步都是以前一步為基礎實現的.介面設計如所示,添加控制項,設定webBrowser1其Anchor屬性為Top、Bottom、Left、Right,實現對話方塊縮放;設定groupBox1其Dock(定義要綁到容器控制項的邊框)為Buttom,實現當瀏覽器縮放時
Time of Update: 2013-11-08
int main(){char *str = "青年雜誌(上半年)";char str1[] = "一份耕耘一份收穫";int nLen = strlen(str);char Temp[4];for (int i=0; i<nLen; i=i+2){memcpy(Temp, str+i, 2);Temp[2]='\0';cout << Temp;}cout << endl;for
Time of Update: 2013-11-08
使用泛型可以定義介面,在介面中定義的方法可以帶泛型參數。比如,我們要實現一個IComparable介面來對兩個類的對象的屬性進行比較。傳統的我們會這麼做: public class Person : IComparable { public string LastName { get; set; } public Person(string lastName) { this.LastName = lastName; } public int
Time of Update: 2013-11-08
//完成一個函數,實現在一個給定字串中尋找子串的功能(不能使用庫函數)。bool IsHaveSubStr(const char* strSrc, const char* strSub){char* p = (char*)strSrc;char* q = (char*)strSub;int nLenSrc;int nLenSub;if (p==NULL||q==NULL ||*p=='\0' || *q== '\0') return false;while
Time of Update: 2013-11-08
什麼是棧結構棧結構是從資料的運算來分類的,也就是說棧結構具有特殊的運算規則,即:後進先出。我們可以把棧理解成一個大倉庫,放在倉庫門口(棧頂)的貨物會優先被取出,然後再取出裡面的貨物。而從資料的邏輯結構來看,棧結構起始就是一種線性結構。如果從資料的儲存結構來進一步劃分,棧結構包括兩類:順序棧結構:即使用一組地址連續的記憶體單元依次儲存棧中的資料。在程式中,可以定義一個指定大小的結構數組來作為棧,序號為0的元素就是棧低,再定義一個變數top儲存棧頂的序號即可。鏈式棧結構:即使用鏈表的的形式儲存棧中各
Time of Update: 2013-11-08
package com.bjpowernode.hibernate;import java.util.Date;/** * 使用者 * @author Longxuan * */public class User {private String id;private String name;private String password;private Date createTime;private Date expireTime;public String getId() {return
Time of Update: 2013-11-08
準備資料#define MAXLEN 100//定義順序表的最大長度struct DATA{char key[10];//結點的關鍵字 char name[20];int age;};structSLType//定義順序表結構 {DATA ListData[MAXLEN+1];//儲存順序表的結構數組int ListLen;//順序表已存結點的數量 };
Time of Update: 2013-11-08