- 博客(22)
- 收藏
- 关注
原创 Shuffle'm Up POJ - 3087 (dfs)
Shuffle'm Up A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with t...
2018-08-28 10:56:45
237
原创 石油大2018年第四阶段组队训练赛第二场 D
问题 D: Playoff时间限制: 2 Sec 内存限制: 128 MB提交: 181 解决: 59[提交] [状态] [讨论版] [命题人:admin]题目描述The Minato Mirai Football Association hosts its annual championship as a single round-robin tournament, in w...
2018-08-24 11:41:33
327
原创 食物链(带权并查集经典题)
食物链 POJ - 1182动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"...
2018-08-13 18:02:40
461
原创 Werewolf (并查集)
Werewolf HDU - 6370 "The Werewolves" is a popular card game among young people.In the basic game, there are 2 different groups: the werewolves and ...
2018-08-12 13:22:31
421
原创 2018杭电多校第六场
A - oval-and-rectangle Patrick Star find an oval. The half of longer axes is on the x-axis with length aa. The half of shorter axes is on the y-axis wi...
2018-08-11 20:27:05
768
原创 BFS DFS模板
//建立搜索区,一维/二维/三维 根据题目需要int map[];//访问数组int vis[];//搜索节点,结构体里的变量根据题目要求建立struct node{ int x,step;};//判断该节点是否符合条件int check(node x){ if()//符合 return 1; return 0;}int bfs(i...
2018-06-24 10:28:00
264
原创 poj 3126 Prime Path (BFS + 素数打表)
poj 3126 (BFS + 素数打表)The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-di...
2018-06-20 17:46:23
193
原创 POJ1426 Find The Multiple (DFS)
E - Find The Multiple POJ - 1426Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the di...
2018-06-13 17:40:22
225
原创 POJ3278 Catch That Cow(BFS)
Catch That CowFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a numbe...
2018-06-12 21:21:04
187
原创 POJ 2251 Dungeon Master 三维空间BFS(基础题)
B - Dungeon Master POJ - 2251 You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute...
2018-06-06 14:51:03
275
原创 Alice and Bob(二进制&&找规律)
Alice and BobTime Limit: 1000 ms Memory Limit: 65536 KiBSubmit Statistic DiscussProblem Description Alice and Bob like playing games very much.Today, they introduce a new game. There is a polyno...
2018-05-03 15:09:45
328
原创 Rescue The Princess(计算几何 旋转角度后下x,y的变化)
Rescue The PrincessTime Limit: 1000 ms Memory Limit: 65536 KiBSubmit StatisticProblem Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue...
2018-05-03 11:46:08
370
原创 A^X mod P 大幂分解求和 打表
A^X mod P Time Limit: 5000 ms Memory Limit: 65536 KiBProblem DescriptionIt's easy f...
2018-05-03 11:27:14
770
原创 浙江省第十四次ACM程序竞赛 Let's Chat(D题)(区间)
浙江省第十四次ACM程序竞赛 Let's Chat(D题)ACM (ACMers'Chatting Messenger) is a famous instant messaging software developed by MarjarTechnology Company. To attract more users, Edward, the boss of Marjar Company,has...
2018-05-01 22:07:08
388
原创 矩阵快速幂 3070
#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int N = 2;const int MOD = 10000;int n;//是幂struct MATRIX{ int mat[2][2];};MATRIX multi...
2018-04-27 10:15:14
183
原创 博弈论
巴什博奕: 只有一堆n个物品,两个人轮流从中取物,规定每次最少取一个,最多取m个,最后取光者为胜。 显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:如果n=(m+1)r+s,(r为任意自然数,s≤m),那么先取者要拿走s个物品,如果后取者拿走k(≤m)个,那么先取者再拿走m+1-k个,结果剩下(...
2018-04-23 19:04:57
292
原创 kmp算法模板及题型总结
对于kmp的理解:https://blog.youkuaiyun.com/v_july_v/article/details/7041827next数组模板:void GetNext(char* p,int next[]) { int pLen = strlen(p); next[0] = -1; int k = -1; int j = 0; wh...
2018-04-21 12:07:31
883
原创 How Many Nines 暴力打表
If we represent a date in the format YYYY-MM-DD (for example, 2017-04-09), do you know how many 9s will appear in all the dates between Y1-M1-D1 and Y2-M2-D2 (both inclusive)?Note that you should take...
2018-04-14 21:59:55
498
原创 K Smallest Sums 多路归并优先队列
K Smallest SumsYou're given k arrays, each array has k integers. There are kk ways to pick exactly one element in each array and calculate the sum of the integers. Your task is to find the k smallest ...
2018-03-31 11:54:24
333
原创 二分搜索
* 二分搜索法,是通过不断缩小可能存在的范围,从而求得问题最优解的方法。下面介绍经典的二分搜索法问题:一.从有序数组中查找某个值lower_bound给定长度为n的单调不下降数列a0····an-1和一个数 k,求满足ai ≥ k 条件的最小的i 。不存在的情况下输出n。 1 ≤ n ≤ 10^6 0 ≤ a0 ≤a1 ≤ ···≤an-1≤ 10^9 0 ≤ k ≤ 10^9输入: ...
2018-03-17 15:33:11
282
翻译 反转(开关问题)
Face the right way POJ NO.3276N头牛排成了一列。每头牛或者向前或者向后。为了让所有的牛都面向前方,农夫约翰买了一台自动转向的机器。这个机器在购买时就必须设定一个数值K,机器每操作一次恰好使K头连续的牛转向。请求出为了让所有牛都能面向前方需要的最少的操作次数M和对应的最小K。限制条件:1 <= N <= 5000输入: 7 BBFBFB...
2018-03-10 15:02:24
1011
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人