原创 匈牙利PKU1469(可以做模板)

http://162.105.81.212/JudgeOnline/problem?id=1469 #include <iostream> #include <algorithm> using namespace std; #defin

原创 PKU 2632 Crashing Robots 模擬

題意簡述:在一個b*a的矩形框內,有n個機器人,告訴其初始位置及方向。     現有m條指令,每條指令可能是轉向或者向前走一步。     試判斷有沒有衝突或者撞牆的情況。 解題思路:模擬 題目鏈接:http://162.105.81.21

原创 c++ 有關string函數和char[]函數

字符串可以用字符數組與字符串變量兩種方式來存儲,效果類似。一、用字符數組來存儲字符串:char st1[100],st2[100] ; //字符數組說明cin>>st1>>st2;long a,b;輸入:hello,  world則st1

原创 計算幾何 Graham_scan凸包 pku 1113

http://162.105.81.212/JudgeOnline/problem?id=1113     Graham掃描法尋找凸包 語法:Graham_scan(Point PointSet[],Point ch[],int n,in

原创 PKU 1459 Ford_Fulkerson(可以做模板)

#include<iostream> #include<queue> using namespace std; #define VMAX 102 int s,t; int father[VMAX]; int c[VMAX][VMAX];

原创 zjut 1517 Miller_Rabin

今天校賽的一道題:[ZJUT1517],一看就知道是大素數驗證,所以自然而然想到了出錯率爲(1/4)^s的RP算法-Miller-Rabbin素性測試,但是網上找到的模板都是wa,只有過PKU1811的少數幾個不wa,後來才發現是在算快速

原创 Prim 模板 hdu 1879

#include<iostream> using namespace std; #define INF 0x111111 int ancs[101][101]; int dis[101];//結點1到其他點的距離 int min_ro

原创 母函數 hdu 1398

/*母函數G(x)=(1+x+x2+x3+x4+…)(1+x4+x8+x12+…)(1+x9+x18+x27+…)… hdu1398 */ #include <iostream> using namespace std; const in

原创 PKU 2993 模擬 c++

#include <iostream> #include <string.h> using namespace std; char map[20][35]; void init(char map[][35]) { for(int

原创 FLOYD_NUAA_1635

#include <string.h> #include <iostream> using namespace std; #define MAX_VERTEX_NUM 101 #define INFINITY 0x11111111 #de

原创 STL之map函數的用法

Map和multimaps根據元素的key自動對元素進行排序。這麼一來,根據已知的key搜尋某個元素時,就能夠有很好的性能,而根據已知value搜尋元素時,性能就很糟糕。map內部自建一顆紅黑樹(一種非嚴格意義上的平衡二叉樹),這顆樹具有

原创 poj 1191 DP by:me

#include<iostream> #include<cmath> using namespace std; #define INF 0x3ffffff int map[9][9]; int dp[15][9][9][9][9]; i

原创 Bellman_Ford模板

Bellman Ford模板 // Bellman_Ford.cpp : Defines the entry point for the console application. // #define MAX_VERTEX_NUM 10

原创 有道難題 有道搜索框

//水過去,不是用最優算法的,只是隨便優化下,調用STL的庫函數簡便直觀地水過去 #include<iostream> #include<vector> #include<string> #include<map>

原创 poj 1191 DP by:other

#include < iostream > #include < cmath > #include<iomanip> #define INF 10000000 using namespace std; const