原创 最短路模板(dijstra)

#define INF 0Xfffffff const int Max=1000000; int map[Max][Max]; int dis[Max]; bool vis[Max]; void dijstra() { memse

原创 hdu1002

就是求兩個很大位數的數的和,測試數據會暴int和long long,所以只能用字符數組存數,並一位一位相加嘍#include<stdio.h> #i

原创 poj1111

Image Perimeters Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 7380   Accepted: 4396 Description Techn

原创 hdu1102

Problem Description There are N villages, which are numbered from 1 to N, and you should build some roads such that eve

原创 poj3085

大致題意:給你四種金幣數額,0.25,0.1,0.05,0.01 ,讓你用最少數量的金幣,使金幣和等於給定金幣N(每種金幣可以用任意數量).哎呀,人家第一道是水題,別見怪哦#include<cstdio> #include<cstring

原创 hdu2544

Problem Description 在每年的校賽裏,所有進入決賽的同學都會獲得一件很漂亮的t-shirt。但是每當我們的工作人員把上百件的衣服從商店運回到賽場的時候,卻是非常累的!所以現在他們想要尋找最短的從商店到賽場的路線,你可以幫

原创 poj2387

Description Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer

原创 poj1002

487-3279 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 230413   Accepted: 40219 Description 企業喜歡用容易被記住

原创 最小生成數模板

int prim() { //low數組用來保存非生成樹中各頂點與生成樹中頂點最短邊的權值;dis數組則是你輸入的數組矩陣 int ans = 0, i, j, flag, min; //ans用來

原创 poj3414

恩,首先解釋題意啦,啦啦啦,給你兩個容器容量分別是A,B,可以對A,B兩個鍋進行三個操作, 1:FILL(i)把i鍋裝滿 2:DROP(i)把i鍋的水倒空 3:POUR(i,j)把i鍋的水倒入j鍋,直到j鍋裝滿 然後如果能把A或者B裝成C

原创 樸素模式串匹配

最大時間複雜度爲|P|(|T|-|P|+1)次 #include<cstdio> #include<cstring> #include<iostream> #include<stack> #include<queue> #include<

原创 poj2386

Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a r