
ACM训练
Alwaysion
more persistent for nothing
个人qq:790693499,欢迎来交流
展开
-
欢迎使用优快云-markdown编辑器
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl原创 2017-07-26 20:03:22 · 173 阅读 · 0 评论 -
D-最短路(poj1860)
题目链接: D-最短路中文题意:我们的城市有几个货币兑换点。让我们假设每一个点都只能兑换专门的两种货币。这里若可以有几个点,专门从事相同货币兑换。每个点都有自己的汇率,外汇汇率A到B是B的汇率数字是1A。同时各交换点有一些佣金,你要为你的交换操作的总和。在来源货币中总是收取佣金。例如,如果你想换100美元到俄罗斯卢布兑换点,那里的汇率是29.75,而佣金是0.39,你原创 2017-07-28 08:25:23 · 362 阅读 · 0 评论 -
基础博弈论(hdu1527+hdu2188+poj1740)
一、基础概念1、奇异局势:指你一定会输的状态,又叫必败状态。例如威佐夫博弈中的(0,0)、(1,2)、(3,5)、(4,7)、(6,10)、(8,13)、(9,15)、(11,18)、(12,20)、...... 、(ak,bk) (k = 0, 1, 2, 3,......)。自己走路正确一定能赢得:(0,0),(1,k),(k,2),(1+k,2+k)2、奇异局势的性质原创 2017-07-26 19:56:55 · 430 阅读 · 0 评论 -
《SDUT1730 数字三角形问题》2关于数字三角形,求最小值最大值的N次纠结。
题目是这样的,给一个数字三角形,让你求和最大的路径,还有一个题是求和最小的路径,示例数据都是一样的, 所以没有贴那个题的图。对于一个刚刚熟悉DP的萌新来说,开始拿到这道题是既有点激动又有点懵逼的。废话不多说,直接上代码了 第一个代码是DP的,用的那个什么规划方程,中间修修改改好多次,终于是做出来了。其中有这么几个常犯的错误:1、输入的时候,i是从0-n-1,但是j是从0-i+1,我弄原创 2017-04-16 20:48:05 · 445 阅读 · 0 评论 -
最长公共子序列
#include#include#include#includeusing namespace std;int main(){ char x[505],y[505]; int sum[505][505],i,j,len1,len2; while(gets(x)) { gets(y); len1=strlen(x);原创 2017-04-15 21:01:45 · 193 阅读 · 0 评论 -
POJ 1326 Prime Path(BFS+素数判断)
Prime PathTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 22951 Accepted: 12713DescriptionThe ministers of the cabinet were quite upset by the message原创 2017-09-03 16:37:05 · 322 阅读 · 0 评论 -
(转)POJ 2049 走迷宫选取经过门最少的路线 BFS搜索
Finding NemoTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 9778 Accepted: 2334DescriptionNemo is a naughty boy. One day he went into the deep sea all转载 2017-08-02 10:08:42 · 360 阅读 · 0 评论 -
HDU1728逃离迷宫
给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位置,只能走到与它相邻的4个位置中,当然在行走过程中,gloria不能走到迷宫外面去。令人头痛的是,gloria是个没什么方向感的人,因此,她在行走过程中,不能转太多弯了,否则她会晕倒的。我们假定给定的原创 2017-07-31 08:22:41 · 193 阅读 · 0 评论 -
POJ 2488 A Knight's Journey(DFS+回溯)
A Knight's JourneyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 46639 Accepted: 15875DescriptionBackground The knight is getting bored of seeing t原创 2017-08-12 15:57:41 · 246 阅读 · 0 评论 -
(转)poj3083Children of the Candy Corn(BFS+DFS)
Children of the Candy CornTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12428 Accepted: 5353DescriptionThe cornfield maze is a popular Halloween转载 2017-08-02 14:02:33 · 204 阅读 · 0 评论 -
POJ 1426 Find The Multiple(BFS+同余模定理)
POJ1426-Find The MultipleFind The MultipleTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 34178 Accepted: 14316 Special JudgeDescriptionGive转载 2017-08-31 18:45:23 · 266 阅读 · 0 评论 -
(部分转载)POJ2191Mersenne Composite Numbers梅森素数
题目链接:POJ2191Mersenne Composite Numbers梅森素数Mersenne Composite NumbersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2361 Accepted: 1102Description原创 2017-08-02 19:05:54 · 353 阅读 · 0 评论 -
莫比乌斯函数(数论)(转载+原创)
一、莫比乌斯函数(Möbius function)是指以下的函数:在这里,λ(n)是刘维尔函数莫比乌斯函数是一个数论函数,它同时也是一个积性函数(i.e.μ(ab) =μ(a)μ(b), a,b互质)当n不等于1时,n所有因子的莫比乌斯函数值的和为0,莫比乌斯函数完整定义的通俗表达:1)莫比乌斯函数μ(n)的定义域是N2)μ(1)=13)当n存在平方因子时,μ(原创 2017-08-01 13:38:53 · 4997 阅读 · 1 评论 -
POJ1328 Radar Installation(贪心)
DescriptionAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, l原创 2017-08-01 08:47:16 · 359 阅读 · 0 评论 -
HDU 2141 Can you find it? (二分)
Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X. InputThe原创 2017-08-09 14:39:00 · 170 阅读 · 0 评论 -
(转) 二分法+高精度——Poj 2109 Power of Cryptography(double型开n次方的方法通过的原因)
Power of CryptographyTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 14584 Accepted: 7412DescriptionCurrent work in cryptography involves (among o转载 2017-08-01 09:53:29 · 344 阅读 · 0 评论 -
(转)POJ3101 Astronomy【素因子分解】【大数乘法】
AstronomyTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 6107 Accepted: 1382DescriptionThere are n planets in the planetary system of star X. They orb转载 2017-08-11 17:07:22 · 262 阅读 · 0 评论 -
POJ 1061青蛙的约会(拓展欧几里得)
题目描述:两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两转载 2017-08-11 10:40:20 · 235 阅读 · 0 评论 -
POJ2115C Looooops(拓展欧几里得)
C LooooopsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20702 Accepted: 5596DescriptionA Compiler Mystery: We are given a C-language style for l原创 2017-08-03 16:06:57 · 250 阅读 · 0 评论 -
POJ3904 Sky Code (容斥原理)
Stancu likes space travels but he is a poor software developer and will never be able to buy his own spacecraft. That is why he is preparing to steal the spacecraft of Petru. There is only one problem原创 2017-08-07 14:32:01 · 382 阅读 · 0 评论 -
POJ 1840 Eqs(哈希)
POJ1840-Eqs大致题意:给出一个5元3次方程,输入其5个系数,求它的解的个数其中系数 ai∈[-50,50] 自变量xi∈[-50,0)∪(0,50] 注意: 若x1 =a, x2=b ,x3=c ,x4=d,x5=e时,与 x1=b, x2=a ,x3=c ,x4 =d, x5=e 代入方程后都得到值0,那么他们视为不同的解。转载 2017-08-30 20:52:56 · 362 阅读 · 0 评论 -
POJ Gold Balanced Lineup (哈希排序)
Gold Balanced LineupTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 15885 Accepted: 4552DescriptionFarmer John's N cows (1 ≤ N ≤ 100,000) share many s转载 2017-08-29 17:27:51 · 330 阅读 · 0 评论 -
POJ 3349 重复的雪花(哈希)
题目链接: POJ3349 重复的雪花You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a col原创 2017-08-08 17:02:36 · 1069 阅读 · 1 评论 -
POJ 2236 Wireless Network(并查集基础)
这个题难点在于理解题意我觉得,题意理解了就很容易看出是一个并查集的题目来。而且还很基础。题目:An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an原创 2017-08-09 19:35:28 · 254 阅读 · 0 评论 -
并查集知识
原文链接:傻子都能看懂的并查集入门其实并查集顾名思义就是有“合并集合”和“查找集合”两种操作的关于数据结构的一种算法。概述性质并查集算法不支持分割一个集合。算法用集合中的某个元素来代表这个集合,该元素称为集合的代表元。一个集合内的所有元素组织成以代表元为根的树形结构。对于每一个元素 parent[x]指向x在树形结构上的父亲节点。转载 2017-08-09 17:28:17 · 234 阅读 · 0 评论 -
(转)POJ 3264 - Balanced Lineup (线段树)
For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things转载 2017-08-10 09:32:17 · 194 阅读 · 0 评论 -
(转)POJ 1062 昂贵的聘礼 (最短路,dijktra算法)
昂贵的聘礼Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 50769Accepted: 15206Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿转载 2017-08-17 09:08:35 · 195 阅读 · 0 评论 -
POJ 2240 Arbitrage(最短路,floyd)
ArbitrageTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 24461 Accepted: 10353DescriptionArbitrage is the use of discrepancies in currency exchange rate原创 2017-08-29 13:21:27 · 276 阅读 · 0 评论 -
(转)什么是Floyd算法:从i号顶点到j号顶点只经过 前 k号点的最短路程
原博地址:坐在马桶上看算法:只有五行的Floyd最短路算法坐在马桶上看算法:只有五行的Floyd最短路算法此算法由Robert W. Floyd(罗伯特·弗洛伊德)于1962年发表在“Communications of the ACM”上。同年Stephen Warshall(史蒂芬·沃舍尔)也独立发表了这个算法。Robert W.Floyd这个牛人是朵奇葩,他原本在芝加哥大学转载 2017-08-25 17:40:35 · 723 阅读 · 0 评论 -
POJ 2253 Frogger(最短路变形,floyd算法)
FroggerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 48119 Accepted: 15310DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Sudd原创 2017-08-17 11:19:29 · 255 阅读 · 0 评论 -
POJ 3259 Wormholes(floyd求负环,最短路)
While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that i原创 2017-08-14 10:16:59 · 443 阅读 · 0 评论 -
POJ 3026 Borg Maze (BFS+prim)
The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. E转载 2017-08-14 20:33:36 · 240 阅读 · 0 评论 -
POJ 1789 Truck History(最小生成树,prim算法)
Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each type of a原创 2017-08-14 11:11:50 · 309 阅读 · 0 评论 -
POJ 3687 Labeling Balls (逆向拓扑排序)
Labeling BallsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14809 Accepted: 4339DescriptionWindy has N balls of distinct weights from 1 unit to N unit原创 2017-08-16 17:06:23 · 293 阅读 · 0 评论 -
POJ 1094 Sorting It All Out(拓扑排序)
An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D im原创 2017-08-15 10:56:38 · 204 阅读 · 0 评论 -
抛硬币 Flipping Coins(Gym - 101606F)(DP)
题意:给出N个硬币,开始均反面朝上。每次挑出其中一个抛,连续K次,求正面朝上的最大数学期望。----------------------------------------------------------------------------------------------------------------------由于是求最大数学期望,所以每次抛硬币即要优先选择反面硬币所以只有两种挑选...转载 2018-05-03 20:18:04 · 486 阅读 · 0 评论 -
【动态规划】最长公共子序列
转载自:https://blog.youkuaiyun.com/hrn1216/article/details/515346071.基本概念 首先需要科普一下,最长公共子序列(longest common sequence)和最长公共子串(longest common substring)不是一回事儿。什么是子序列呢?即一个给定的序列的子序列,就是将给定序列中零个或多个元素去掉之后得到的结果。什么是...原创 2018-04-08 21:15:55 · 390 阅读 · 0 评论 -
【动态规划1】最长上升子序列问题
【题目描述】给定N个数,求这N个数的最长上升子序列的长度。【样例输入】72 5 3 4 1 7 6【样例输出】4 什么是最长上升子序列? 就是给你一个序列,请你在其中求出一段不断严格上升的部分,它不一定要连续。就像这样:2,3,4,7和2,3,4,6就是序列2 5 3 4 1 7 6的两种选取方案。最长的长度是4.那么,怎么求出它的最大上升子序列长度为4呢?这里介绍两种方法,都是以动态规划为基础的...原创 2018-04-07 20:16:53 · 319 阅读 · 0 评论 -
POJ 1837 Balance (DP-01背包)
BalanceTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 15217 Accepted: 9562DescriptionGigel has a strange "balance" and he wants to poise it. Actually转载 2017-09-12 17:55:44 · 293 阅读 · 0 评论 -
POJ 2151 Check the difficulty of problems(DP)
Check the difficulty of problemsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 4403 Accepted: 1941DescriptionOrganizing a programming contest is转载 2017-08-29 21:27:30 · 278 阅读 · 0 评论