自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 【HTML】【CSS】学习网址

HTML:https://www.w3school.com.cn/html/index.aspCSS:https://www.w3school.com.cn/css/index.asp

2019-09-18 18:03:50 205

转载 【单调栈】D. Jumping Buildings(codeforces)

题目:Bob is developing a new game called jumping Lario. In this game the main protagonist, Lario, has to jump on top of buildings until he reaches the end of the level. The level is composed of N build...

2019-09-10 21:37:04 378

原创 【多重背包】HDOJ2191

多重背包特点:取的物品数量有限制。题目大意:输入c组数据,然后输入总资产n和m组可供选择的物品,然后输入资产v[],价值w[],袋数num[].输出最大价值。#include<bits/stdc++.h>using namespace std;const int maxn=500;int c;int n,m;int v[maxn],w[maxn],num[maxn];...

2019-09-03 21:07:54 120

原创 【完全背包】HDOj1963

完全背包特点:对于物品没有取的次数限制。题目大意:给定次数t,起始资金st和存储年数year,给定n个存储政策的资金v[]和收益w[],问year年之后本金和收益一共为多少。#include<bits/stdc++.h>using namespace std;const int maxn=1000010;int t;int st,year;int n;int v[m...

2019-09-03 11:26:01 154 1

转载 【dfs】C. Jumping on Walls(codeforces)

题目:Vasya plays a computer game with ninjas. At this stage Vasya’s ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let’s imagine th...

2019-08-30 17:08:32 183

原创 【kmp】F - Compress Words (codeforces)

题目:time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmugae has a sentence consisting of nn words. He want to compress this sentence into one wo...

2019-08-27 16:46:27 263

原创 【输入输出流】解决cin比scanf慢

使用cin时发现很多时候换成scanf就AC,否则就TLE。这是因为cin需要将输入数据存入缓存再输出导致时间变长,而在使用cin前在main中加入以下两句,cin、cout的时间就与scanf、printf相差不多了 ios::sync_with_stdio(0); cin.tie(0);...

2019-08-27 15:42:23 536

原创 【最大公约数】Round Corridor

题目:Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by nn sectors, and the outer area is equally divided by mm sectors. A wall exists be...

2019-08-27 14:02:37 303

原创 【中国剩余定理】韩信点兵

题目:输入:3 5 7 //列数2 1 6 //余数输出:41//总人数#include<iostream>#include<cstdio>#include<cmath>#include<algorithm>#include<string>#include<...

2019-08-26 17:48:33 395

原创 【环形博弈】hdu3951

题目:The game goes like this:Two players start the game with a circle of n coins.They take coins from the circle in turn and every time they could take 1~K continuous coins.(imagining that ten coins...

2019-08-26 16:07:48 180

原创 【斐波那契博弈】hdu2516

题目:Problem Description1堆石子有n个,两人轮流取.先取者第1次可以取任意多个,但不能全部取完.以后每次取的石子数不能超过上次取子数的2倍。取完者胜.先取者负输出"Second win".先取者胜输出"First win".Input输入有多组.每组第1行是2<=n<2^31. n=0退出.Output先取者负输出"Second win". 先取者胜输出...

2019-08-26 14:40:14 113

原创 【gcd最大公约数】【最小公倍数】

返回最大公约数:int gcd(int a,int b){return a==0?b:gcd(b%a,a);}最小公倍数:两数乘积除以最大公倍数

2019-08-22 10:06:20 135

原创 【快速排序】【模板】洛谷P1177

输入54 2 4 5 1输出1 2 4 4 5找一个点temp,每次都把小于它的放它左边,大于它的放它右边时间复杂度最大N2,最小NlogN#include<iostream>#include<math.h>#include<algorithm>#include<string.h>using namespace std;int...

2019-08-21 10:47:42 198

原创 Codeforces Round #135 (Div. 2)-C. Color Stripe

Codeforces Round #135 (Div. 2)-C. Color Stripe链接:http://codeforces.com/group/xrTA2IaQje/contest/249069/problem/E1:m>2时分情况(与前后进行比较),m<=2时讨论ABAB和BABA,注意500005.。。。m=1时不用变,但是我代码中没考虑到这个。写的很杂乱,比较菜...

2019-08-21 10:43:58 2155

原创 【kmp模板】洛谷P3375

题目描述:如题,给出两个字符串s1和s2,其中s2为s1的子串,求出s2在s1中所有出现的位置。为了减少骗分的情况,接下来还要输出子串的前缀数组next。(如果你不知道这是什么意思也不要问,去百度搜[kmp算法]学习一下就知道了。)输入格式第一行为一个字符串,即为s1第二行为一个字符串,即为s2输出格式若干行,每行包含一个整数,表示s2在s1中出现的位置接下来1行,包括lengt...

2019-08-21 10:28:05 120

原创 【威佐夫博弈】洛谷P2252

题目描述有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。输入:第一行共两个数a, b,表示石子的初始情况。输出:第一行为一个数字1、0或-1,如果最后...

2019-08-21 10:17:36 160

原创 【博弈SG】HDOJ1847

题目:Problem Description大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。这不,Kiki和Cici在每天晚上休息之前都要玩一会儿扑克牌以放松神经。“升级”?“双扣”?“红五”?还是“斗...

2019-08-21 09:43:52 118

原创 【博弈SG】HDOJ1846

和S-Nim这道题很像。看成只有一堆。题目Problem Description十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫《勇敢者的游戏》(英文名称:Zathura),一直到现在,我依然对于电影中的部分电脑特技印象深刻。今天,大家选择上机考试,就是一种勇敢(brave)的选择;这个短学期,我们讲的是博弈(game)专题;所以,大家现在玩的也是“勇敢者的游戏”...

2019-08-20 10:59:59 99

原创 【博弈】【找规律】HDOJ1517

题目A Multiplication GameProblem DescriptionStan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p = 1, does his multiplica...

2019-08-20 10:32:32 97

转载 【递归】Coffee Chicken

链接:https://ac.nowcoder.com/acm/contest/890/B题目描述Dr. JYY has just created the Coffee Chicken strings, denoted as S(n). They are quite similar to the Fibonacci soup — today’s soup is made by mingling ...

2019-08-19 16:48:38 137

转载 【中国剩余定理+拓展欧几里得】【模板】洛谷P3868

题目描述现有两组数字,每组k个,第一组中的数字分别为:a1,a2,…,ak表示,第二组中的数字分别用b1,b2,…,bk表示。其中第二组中的数字是两两互素的。求最小的非负整数n,满足对于任意的i,n - ai能被bi整除。输入格式输入数据的第一行是一个整数k,(1 ≤ k ≤ 10)。接下来有两行,第一行是:a1,a2,…,ak,第二行是b1,b2,…,bk输出格式输出所求的整数n。输...

2019-08-19 15:15:10 120

原创 【博弈SG】HDOJ1536:S-Nim

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1536SG讲解:https://www.cnblogs.com/aiguona/p/9126324.html检验最好用bool,这道题book[ ]用int超时要了我的老命。题中没说默认升序,卡到绝望救命:为什么输入aa[ ]时我从1开始时,并且在第一个for循环中的j也从1开始,并且结束也是&...

2019-08-18 10:54:50 151

原创 【二分查找】codeforces:Enduring Exodus

二分查找:(百度百科)——折半查找法也称为二分查找法,它充分利用了元素间的次序关系,采用分治策略,可在最坏的情况下用O(log n)完成搜索任务。它的基本思想是:(这里假设数组元素呈升序排列)将n个元素分成个数大致相同的两半,取a[n/2]与欲查找的x作比较,如果x=a[n/2]则找到x,算法终止;如 果x<a[n/2],则我们只要在数组a的左半部继续搜索x;如果x>a[n/2],则...

2019-08-17 10:41:49 199

原创 【并查集】codeforces:New Reform

A. New ReformBerland has n cities connected by m bidirectional roads. No road connects a city to itself, and each pair of cities is connected by no more than one road. It is not guaranteed that you c...

2019-08-16 14:16:10 142

原创 【巧思】连续子串

E. StringString x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)), that xi < yi, and for any j (1 ≤ j < i) xj =...

2019-08-14 16:34:54 329

转载 【并查集】D. Arpa's weak amphitheater and Mehrdad's valuable Hoses

题目 D. Arpa’s weak amphitheater and Mehrdad’s valuable HosesMehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may ha...

2019-08-14 16:13:04 85

原创 博弈学习--博客网址

https://blog.csdn.net/acm_cxlove/article/details/7854530

2019-08-14 15:53:43 148

原创 【尼姆博弈】洛谷P1247

**题目链接:**https://www.luogu.org/problem/P1247#include<iostream>#include<cstdio>#include<string>#include<string.h>#include<cstring>#include<algorithm>#include&...

2019-08-14 15:42:09 127

原创 【尼姆博弈】HDOJ1907

做之前参考理解博弈思想:https://blog.csdn.net/acm_cxlove/article/details/7854530题目#Problem DescriptionLittle John is playing very funny game with his younger brother. There is one big box filled with M&Ms ...

2019-08-14 15:37:31 112

原创 【背包基础题】洛谷P1048/P1060

P1048#include<bits/stdc++.h>using namespace std;int timee,n;int f[1001];int c[1001];int w[1001];int main(){ cin>>timee>>n; memset(f,0,sizeof(f)); for(int i=1;i<=...

2019-08-10 11:08:03 133

原创 【栈】UVA514铁轨

参考《算法竞赛入门经典》第二版刘汝佳P141输入(样例1):55 4 3 2 1输出:Yes输入(样例2):52 3 5 4 1输出:Yes思路:栈:先进后出以样例2为例:如图A即是指针,因为从A输入只有两种选择A—C或者A—B,s代表进B,图中1进入s后,代码以样例#include<iostream>#include<cmath>#inc...

2019-08-07 17:20:42 191

转载 【并查集】CF722C Destroying Array

代码根据此博客https://blog.csdn.net/acerandaker/article/details/82351251输入样例1:41 3 2 53 4 1 2 *分析:逆着插入+并查集#include<iostream>#include<cmath>#include<algorithm>#include<strin...

2019-08-07 13:47:55 245

原创 【并查集模板题】洛谷P3367

代码参照此博客学习得:https://blog.csdn.net/zjy_code/article/details/80634149复杂:#include<iostream>#include<cmath>#include<algorithm>#include<string>#include<string.h>using na...

2019-08-07 10:17:53 124

原创 最大连续子段和及其区间

#include<iostream>#include<cmath>#include<algorithm>#include<stdio.h>#include<string.h>#include<queue>#include<vector>#include<set>#include<m...

2019-07-30 15:50:02 265

空空如也

空空如也

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

TA关注的人

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