
ACM 培训
文章平均质量分 73
swust_t_p
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
迷宫问题bsf ACM第三次培训
#include #include #include #include #include #include #include using namespace std; int maze[5][5]; int map_sign[5][5] = { 0 }; int d[4][2] = { 0,1,1,0,0,-1,-1,0 }; struct node { int x, y, p; }; stru原创 2016-11-30 08:42:23 · 522 阅读 · 0 评论 -
bfs find cow
#include #include #include #include #include #include #include using namespace std; struct move { int vis; int time; }; int d[2] = { 1,-1 }; int visa[200000]; int bfs(int s,int e) { if (s == e)原创 2017-02-21 21:50:53 · 423 阅读 · 0 评论 -
小希的迷宫 并查集
#include #include #include #include #include #include #include using namespace std; int a[100005]; void s() { for(int i=0;i<100000;i++) { a[i] = i; } } int find(int x) { if (a[x] == x) { r原创 2017-03-05 10:39:18 · 312 阅读 · 0 评论 -
畅通工程 并查集
ContribContrib/a11y/accessibility-menu.js 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数原创 2017-03-05 11:32:50 · 477 阅读 · 0 评论 -
HDU233 还是畅通工程(最小生成树)
某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每行给出一对正整数,原创 2017-03-18 20:27:06 · 257 阅读 · 0 评论 -
HDU 1213 how many tables
Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, a原创 2017-03-05 22:15:24 · 372 阅读 · 0 评论 -
poj3468 Simple Problem with Integers (线段树)
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for t原创 2017-04-15 17:04:44 · 277 阅读 · 0 评论 -
HDU 6019 MG loves gold
MG is a lucky boy. He is always be able to find gold from underground. It is known that the gold is a sequence with nn elements, which has its own color CC. MG can dig out a continuous原创 2017-04-22 15:05:55 · 636 阅读 · 0 评论 -
hdu 6011 Lotus and Characters
Lotus has nn kinds of characters,each kind of characters has a value and a amount.She wants to construct a string using some of these characters.Define the value of a string is:its first character's原创 2017-05-13 10:41:32 · 254 阅读 · 0 评论 -
Codeforces 702D Road to Post Office(模拟 + 公式推导)
Vasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d kilometers. Vasiliy's car is not new — it breaks after driven every k kilometers原创 2017-10-07 16:20:43 · 382 阅读 · 0 评论 -
排序
题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。 任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到最后一个排列,则下1排列为第1个排列,即排列1 2 3…n。 比如:n = 3,k=2 给出排列2 3原创 2017-01-18 21:08:20 · 618 阅读 · 0 评论 -
数塔
在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的: 有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少? 已经告诉你了,这是个DP的题目,你能AC吗? Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 0,990,99内。 Output对于每个测试实例,输出可能得原创 2016-12-18 10:30:22 · 290 阅读 · 0 评论 -
滑雪 记忆化搜索
Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13原创 2016-12-18 09:48:48 · 210 阅读 · 0 评论 -
bsf 迷宫三维
#include #include #include #include #include #include #include using namespace std; int n, sx, sy, sz, ex, ey, ez; char mp[15][15][15]; int vis[15][15][15]; int d[6][3] = { 0,0,1,0,1,0,1,0,0,0,0,-1,0原创 2016-11-30 16:34:59 · 253 阅读 · 0 评论 -
dfs n皇后问题
#include #include #include #include #include #include #include using namespace std; int n; int hang[11]; int sum; void dfs(int x,int y) { if(x==y) { sum++; return; } for(int i=0;i<n;i++) {转载 2016-12-10 23:03:38 · 280 阅读 · 0 评论 -
bsf find a way
Submit Status Description Input Output Sample Input Sample Output Hint Description Pass a year learning in Hangzhou, yifenfei arrival hometow原创 2016-12-01 23:01:19 · 247 阅读 · 0 评论 -
bfs 胜利大逃亡
Description Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会. 魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一原创 2016-12-02 17:16:16 · 308 阅读 · 0 评论 -
优先bsf rescue
Submit Status Description Input Output Sample Input Sample Output Hint Description 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻原创 2016-12-02 23:28:55 · 289 阅读 · 0 评论 -
bfs 走马 棋盘
写了半天发现没看题 走的是马才对QAQ D - Knight Moves Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Descriptio原创 2016-12-03 17:37:36 · 515 阅读 · 0 评论 -
dfs Red and Black
Submit Status Description Input Output Sample Input Sample Output Hint Description There is a rectangular room, covered with square tiles. Ea原创 2016-12-04 10:35:00 · 244 阅读 · 0 评论 -
dfs 棋盘问题
Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子转载 2016-12-04 23:48:01 · 388 阅读 · 0 评论 -
dfs 变形课
呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作用就恰好是使A物体变成B物体. Harry已经将他所会的所有咒语都列成了一个表,他想让你帮忙计算一下他是否能完成老师的作业,将一个B(ball)变成一个M(Mouse),你知道,转载 2016-12-06 19:04:51 · 293 阅读 · 0 评论 -
HDU6188 duizi and shunzi
Nike likes playing cards and makes a problem of it. Now give you n integers, ai(1≤i≤n)ai(1≤i≤n) We define two identical numbers (eg: 2,22,2) a Duizi, and three consecutive positive integers (eg: 2,3,4...原创 2018-04-11 20:38:16 · 226 阅读 · 0 评论