自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 收藏
  • 关注

原创 Professional Manager 并查集

链接:https://www.nowcoder.com/acm/contest/106/C来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld题目描述 It’s universally acknowledged that there’re innumerable trees in the c...

2018-04-30 16:51:22 138

原创 zoj4033 思维题

CONTINUE...? Time Limit: 1 Second      Memory Limit: 65536 KB      Special Judge ...

2018-04-30 16:26:53 345

原创 Various Tree bfs+二进制1的个数

链接:https://www.nowcoder.com/acm/contest/106/J来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. And there are many different types of trees in HUST, each o...

2018-04-29 19:26:39 87

原创 牛客网Beautiful Trees Cutting(快速幂+逆元+费马小定理)||(快速幂+等比数列求和)

链接:https://www.nowcoder.com/acm/contest/106/B来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld题目描述 It’s universally acknowledged that there’re innumerable trees in the c...

2018-04-29 19:19:49 324

原创 K序列 最长子序列和%k==0

链接:https://www.nowcoder.com/acm/contest/91/L来源:牛客网空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld题目描述给一个数组 a,长度为 n,若某个子序列中的和为 K 的倍数,那么这个序列被称为“K 序列”。现在要你 对数组 a 求出最长的子序列的长度,满足这个序列是 K 序列。 输入描述:第一行为两...

2018-04-28 20:50:41 1216

原创 紫书uva 10603 优先队列+bfs

https://vjudge.net/problem/UVA-10603这个题目其实是暴力的一个典范,首先题目说了是最小倒水数,也就是总共次数中转移水的数量,bfs是找最小次数的,因此要用优先队列来改变优先级,将最小倒水数优先,然后是处理如果找不到合适的d,我们要把所有能够找到的值都存放在一个数组里面,然后遍历一次就可以了,我用的vis数组是三维的,用来表示第1,2,3个杯子的水量,和紫书上的略有...

2018-04-28 00:57:49 162

原创 poj1661 dp(加强版的数字三角形)

Help JimmyDescription"Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度无限。 Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当Jimmy落到某个平台上时,游戏者选择让它向左还是向右跑,它跑动的速度也是1米/秒。当Jimmy跑到平台的边缘时,开始继续下落。Jimm...

2018-04-28 00:53:13 179

原创 hdu1160最长上升子序列

#include <iostream>#include <cstring>#include <cmath>#include <algorithm>#include <cstdio>#include <stack>using namespace std;struct node{ int w; i...

2018-04-27 00:59:18 151

原创 hdu1144 完全背包

Piggy-BankTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2940    Accepted Submission(s): 1452Problem DescriptionBefore ACM can do anything, a b...

2018-04-27 00:57:16 228

原创 hdu4004 二分

题意:给出n个石头,对岸距离L,可以跳跃次数m,问最短跳跃距离是多少,可以踩着石头过河。这题目先排一下序,然后我们把起点和对岸终点同样看作一个石头,那么我们只需要对跳跃距离二分就可以了,这里需要点思考,什么时候跳跃次数最少?就是我们每次可以跳跃到的最远那个石头跳跃次数就是最短的,这样思考就可以AC了。原本以为我的代码会在恰好再第m次跳到终点时出bug,其实是不会的,因为当可以跳到的距离,我们先保存...

2018-04-26 22:29:46 91

原创 hdu1087 最大上升子序列模板

Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The ga...

2018-04-26 15:52:21 142

原创 hdu 1069 最长上升子序列和

A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the mo...

2018-04-26 15:01:59 109

原创 hdu 1024 dp 最长连续子序列和加强版

Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem. Giv...

2018-04-26 01:15:09 173

原创 poj3501 Escape from Enemy Territory 二分+预处理+bfs

Escape from Enemy TerritoryTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 2741 Accepted: 752DescriptionA small group of commandos has infiltrated deep into enemy territory. They have just a...

2018-04-24 22:41:51 210

原创 poj3104 二分

DryingTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 20920 Accepted: 5265DescriptionIt is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is no...

2018-04-24 09:20:54 103

原创 poj1243 猜数最大 dp

One PersonTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 2122 Accepted: 1426DescriptionIn the game show "The Price is Right", a number of players (typically 4) compete to get on stage by gu...

2018-04-23 17:04:09 142

原创 51nod---1432 独木舟贪心

1432 独木舟 n个人,已知每个人体重。独木舟承重固定,每只独木舟最多坐两个人,可以坐一个人或者两个人。显然要求总重量不超过独木舟承重,假设每个人体重也不超过独木舟承重,问最少需要几只独木舟? 输入: 第一行包含两个正整数n (n<=10000)和m (m<=2000000000),表示人数和独木舟的承重。 接下来n行,每行一个正整数,表示每个人的体重。体重不超过1000000000...

2018-04-23 13:40:07 138

原创 poj1700过河问题(贪心)

Crossing RiverTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10871 Accepted: 4097DescriptionA group of N people wishes to go across a river with only one boat, which can at most carry two p...

2018-04-23 11:16:20 2650 1

原创 UVALive 6853-Concert Tour(dp)

题意:有s个月,c个城市,给出第几个月在第几个城市举办演唱会的收益,并且给出从一个城市到另一个城市的成本,求最大的收益。到达第一个城市不需要成本。用dp[i][j]表示第j个月在第i个城市举办演唱会可以得到的最大收益。抄一下别人的题意,这道题目处理一下上一个月上一个城市到这个月这一个城市就好了转移方程: dp[i][j]=max(dp[i][j],dp[k][j-1]+pro[i][j]-cos...

2018-04-23 00:18:07 106

原创 zoj4011 动态规划

https://vjudge.net/problem/ZOJ-4011给定一个n,m,要求一个m为长度,并且从第一项起有b[i+1]%b[i]==0的数列,求出组合个数(1<=b[i]<=n)利用dp来做,数组dp[i][j]表示在长度为i时,以j为结尾的数列,边界条件为dp[1][i]=1,因为当长度为1时,以i为结尾的数列只有一个。转移方程为dp[i][k]=d[i][k]+dp[...

2018-04-22 21:45:08 176

原创 poj1281 multiset的应用

MANAGERTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3060 Accepted: 1081DescriptionOne of the programming paradi...

2018-04-22 11:40:55 184

原创 UVALive 6852 优化枚举

https://vjudge.net/problem/UVALive-6852题目放在这里,模型就是覆盖问题,问被0,1...n张被子覆盖的人数这道题从re,到tle,再到wa,再到ac,花费了很多力气,题目关键在于a,b是在(1,16)范围的,因此区间总数最大16*16/2=128,本来想着O(128m)枚举就过了,没想到最后优化成最简版本的O(128*m)还是TLE,那么我只好去学习别人的优化...

2018-04-21 11:46:41 80

原创 (二分)scau校赛题目+poj2456

Treasure Description Li likes playing games. One of games names Finding Treasure. In the game, you have given a map (N*M). The coordinate坐标 (1,1) is the start position and (N , M) is the Treasure....

2018-04-20 00:38:38 194

原创 Poj1041无向图欧拉回路

Little Johnny has got a new car. He decided to drive around the town to visit his friends. Johnny wanted to visit all his friends, but there was many of them. In each street he had one friend. He star...

2018-04-19 22:27:39 270

原创 紫书uva10129欧拉回路

题目类型: 欧拉道路题目:Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle...

2018-04-19 17:20:42 267

原创 poj1166无脑暴力

The ClocksTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 15357Accepted: 6230Description|-------| |-------| |-------|| | | | | | ||---O | |---O | | ...

2018-04-19 13:14:09 203

原创 poj1011dfs+剪枝

SticksTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 151961 Accepted: 36190DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units lon...

2018-04-19 00:12:02 142

原创 初入算法篇(动态规划)URAL1167

Every day, farmer Ion (this is a Romanian name) takes out all his horses, so they may run and play. When they are done, farmer Ion has to take all the horses back to the stables. In ord...

2018-04-18 22:06:14 248

原创 zoj4016用list去模拟栈

Given initially empty stacks, there are three types of operations: 1 s v: Push the value onto the top of the -th stack.2 s: Pop the topmost value out of the -th stack, and print that value. ...

2018-04-16 17:31:28 205

原创 数据结构篇(并查集)poj1182

动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y...

2018-04-15 00:49:34 203 1

原创 牛客练习赛15

链接:https://www.nowcoder.com/acm/contest/83/B来源:牛客网时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld题目描述 第一次期中考终于结束啦!沃老师是个语文老师,他在评学生的作文成绩时,给每位学生的分数都是一个小于10的非负小数。 Amy 8...

2018-04-14 11:55:04 194

原创 poj 1456 Supermarket 单纯贪心||贪心+优先队列||贪心+并查集

A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the...

2018-04-13 21:14:59 214

原创 kaungbing 专题5并查集

poj2236并查集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 unexpected aftershock attacked, all c...

2018-04-13 17:36:40 131

原创 scau_10317 Fans of Footbal Teams并查集的应用

10317 Fans of Footbal Teams时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: G++;GCCDescription Two famous football teams, named AC Milan(AC米兰) and Inter Milan(国际米兰) will have a match in GuangZhou ...

2018-04-12 19:25:28 168

原创 Gym - 100283F F. Bakkar In The Army 二分

StatementsBakkar is now a senior college student studying computer science. And as many students; Bakkar fell in love with one of his finest colleagues Maymona. And as Bakkar has no brothers he is cou...

2018-04-12 13:49:40 264

原创 数据结构篇(并查集)基础模板+poj2524

亲戚关系:给出m对亲戚关系,如果a和b是亲戚,b和c是亲戚,那么a和c也是亲戚,给出k个询问,问每对询问的两个值是否是亲戚,如果是输出Yes,不是输出No典型并查集模板#include <iostream>#include <cstdio>using namespace std;int father[20001];int find(int x){ int ...

2018-04-10 00:25:01 110

原创 scau13校赛17115 ooxx numbers 暴力打表+因数和

17115 ooxx numbers时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: G++;GCCDescription a number A called oo number of a number B if the sum of all As factor is the number B.(A,B) is a pair of ooxx...

2018-04-09 11:44:00 563

原创 K 小马哥的超级盐水 分治+暴力

链接:https://www.nowcoder.com/acm/contest/94/K来源:牛客网时间限制:C/C++ 5秒,其他语言10秒空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld题目描述 小马哥有杯盐水,第杯有单位的盐和单位的水。小马哥很无聊,于是他想知道有多少种这杯盐水的非空子集,倒在一起之后盐和水的比是输入描述:输入第一行包...

2018-04-08 14:06:31 309

原创 kuangbin 专题一 简单搜索

A在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*...

2018-04-07 00:24:18 1102

原创 wyh的天鹅 vector暴力做

链接:https://www.nowcoder.com/acm/contest/93/L来源:牛客网时间限制:C/C++ 3秒,其他语言6秒空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld题目描述 你们wyh学长小时候住在河边,因为周围的生态环境非常好,所以经常会有天鹅浮在湖面上,每只天鹅都长得不一样,它们偶尔排成一排,偶尔分散开,偶尔也会...

2018-04-06 00:53:25 205

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除