Time of Update: 2018-12-07
#include<iostream>#include<queue>using namespace std;#define max 1001 //這裡最後不能加分號,否則他把 max 的值定義為“1001;”int s[10][10];int t[10][10][5];int map[4][2]={{1,0},{0,1},{-1,0},{0,-1}};int i,j,k,x,y; struct node{ int x; int
Time of Update: 2018-12-07
//////////////////////////////////////////////////////////////////////帶權的最長公用子串//dp經典例題#include<iostream>#include<string>using namespace std;char x[5000],y[5000];char ch[256];int a[256]; void LCSLength(int m,int n,int num,char *x,char *y,
Time of Update: 2018-12-07
這裡列出幾個常用的記憶體處理函數,作為簡單的介紹和比較使用memccpy 原型:extern void *memccpy(void *dest, void *src, unsigned char ch, unsigned int count); 用法:#include <string.h> 功能:由src所指記憶體地區複製不多於count個位元組到dest所指記憶體地區,如果遇到字元ch則停止複製。
Time of Update: 2018-12-07
/////////////////////////////////////////////////////////////#include<iostream>using namespace std;char st[10][10];int dimen[10]; int main(){ int n; while(cin>>n && n!=-1) { int i; int a,b,c; int min,
Time of Update: 2018-12-07
//////////////////////////////////////////////////////////////最小花費路//用最小產生樹Prim演算法#include<iostream>using namespace std;#define MAX 1000int c[28][28]; //先讓輸入轉化為鄰接矩陣儲存void input(int n){ int i,j,num,cost; char ch; for(i=1;i<=n;i++)
Time of Update: 2018-12-07
#include<iostream>using namespace std;long st[1000000]; int main(){ long casenum; cin>>casenum; while(casenum--) { long len,num; cin>>len>>num; long i; for(i=0;i<num;i++)
Time of Update: 2018-12-07
//////////////////////////////////////最長升序數//用dp+二分法//若用常規的做法用n^2的時間,用二分以後降為nlogn //
Time of Update: 2018-12-07
一般是控制項綁定了變數,該控制項被刪除後,忘記在DoDataExchange中將其對應的DDX_語句刪除。只要刪除就OK了。最好resource裡的資源ID也一起幹掉。------------------------------------------------------------------------------------------------近來在vc中遇到 dlgdata.cpp的問題,一般情況下,出現這種問題的原因:
Time of Update: 2018-12-07
//////////////////////////////////////////////////////////////////////最長公用子串//dp經典例題#include<iostream>#include<string>using namespace std;char x[10000],y[10000]; void LCSLength(int m,int n,char *x,char *y,int **c,int **b){ int i,j;
Time of Update: 2018-12-07
本文大部分參考別人的文章,加上自己的一些改動,我用的是Ubuntu9.10先交代一下我的基本配置: 我是通過一個路由器,串連了電腦和開發板。電腦的IP地址為:192.168.1.167,開發板的IP地址為:192.168.1.230,網關為:192.168.1.1,子網路遮罩為:255.255.0.0
Time of Update: 2018-12-07
//////////////////////////////////////////////////////////2^x mod n = 1//給出n,算出最小的x滿足2^x mod n = 1//思路:高精度,需要不斷地縮小資料的規模。首先,n=1和n=2的倍數時不存在x,// 其次,每次把2^k nod n的餘數乘2,得到是原(2^k)*2的餘數,即2^(k+1)// 的餘數。 #include<iostream>using namespace
Time of Update: 2018-12-07
//2345國王金幣數//思路:先找出allnum(allnum<=n)使allnum=1+2+3+…+k,同時算出k,則f(allnum)=∑i^2,// 而f(n)=f(allnum)+(n-allnum)*(k+1). 已知公式∑i^2=k*(k+1)*(2k+1)/6#include<iostream>#include<math.h>using namespace std; void coins(int n){ int k=1;
Time of Update: 2018-12-07
///////////////////////////////////////////////////////////////////1161 多湖釣魚 枚舉+貪心 也是POJ
Time of Update: 2018-12-07
我編譯的是在Ubuntu9.10下編譯 Linux-2.6.33核心(原來核心Linux-2.6.31.……) 首先需要前期準備,由於Ubuntu沒有相關的編譯工具,所以應該先安裝Vim,build-essential,ncurses-dev這幾個工具前期準備:1. 安裝編譯器(這其實是一個開發套件) sudo apt-get install build-essential2. 安裝nurse(運行 menuconfig 必需) sudo apt-get install
Time of Update: 2018-12-07
#include <stdio.h>#include <stdarg.h> //要包含這個標頭檔void variable(int i, ...){ int j = 0; va_list arg_ptr; //第1步,定義這個指向參數列表的變數 va_start(arg_ptr, i);//第2步,把上面這個變數初始化.即讓它指向參數列表 while( j != -1 )
Time of Update: 2018-12-07
//////////////////////////////////////////////////////////1889 n的倍數使11111…位元最少//思路:使題意轉變為:給出n,算出最小的x滿足10^x mod 9n = 1 (思路完全與1489一樣)// 高精度,需要不斷地縮小資料的規模。首先,n=1時,x=0;// 其次,每次把10^k nod 9n的餘數乘10,得到是原(10^k)*10的餘數,即10^(k+1)//
Time of Update: 2018-12-07
#include<iostream>#include<queue>using namespace std;char a[205][205],guodu[205][205];int t[205][205],guodu2[205][205];int map[4][2]={{1,0},{0,1},{0,-1},{-1,0}};int x,y,counter; struct node{ int x; int y;};node
Time of Update: 2018-12-07
/////////////////////////////////////////////////最大堡壘數//用回溯法(其實是N皇后問題的改裝)+暴力A掉#include<iostream>#include<math.h>using namespace std;char a[5][5]; //堡壘類,方便對成員的訪問class Blockhouses{ friend int nBlock(int);private: bool Place(int k);
Time of Update: 2018-12-07
#include <iostream>using namespace std;int st[105][105];int row[105],col[105]; int main(){ int n; while(cin>>n && n!=0) { int i,j; for(i=0;i<n;i++) { row[i]=0; col[i]=0;
Time of Update: 2018-12-07
//除餘加密//由於被除數與餘數同餘,而且均小於28,則相互mod相同#include<iostream>#include<string>using namespace std;char st[100],en[100];int stnum[100],ennum[100]; int main(){ int i,k,len,pos; while(cin>>k && k!=0) { cin>>st;