规律
文章平均质量分 54
_pkm_
love coding
展开
-
杭电1276 STL模拟
士兵队列训练问题 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3604 Accepted Submission(s): 1689 Problem Description 某部队进行新兵队列训练,将新兵从一原创 2014-09-27 20:14:37 · 552 阅读 · 0 评论 -
#1144 : 01串 ( 按条件排除即可+简单模拟 )
#1144 : 01串 时间限制:7000ms 单点时限:1000ms 内存限制:256MB 描述 给定两个整数n和m,求是否存在恰好包含n个0和m个1的01串S,使得S中不存在子串"001"和"11"。 如果存在符合条件的01串则输出字典序最小的S,否则输出NO。 输入 一行两个整数,表示n和m。(0 输出 一行一个字符串,为字典序最小的S或者NO。 样原创 2015-04-16 16:53:58 · 746 阅读 · 0 评论 -
HDU 5778(abs 暴力)
题目链接 由于y质因数分解式中每个质因数均出现2次,那么y是一个完全平方数,设y=z*z,题目可转换成求z,使得每个质因数出现1次. 我们可以暴力枚举z,检查z是否符合要求,显然当z是质数是符合要求,由素数定理可以得,z的枚举量在logn级别 特殊判断一的情况就好了 #include<cstdio> #include<algorithm> #include<iostream> #include原创 2016-07-31 13:11:19 · 321 阅读 · 0 评论 -
HDU 5777 (domino 贪心)
题目链接 给你一些骨牌,你有k次选择的机会,推到其中的一个,只能他能达到的位置都会被推到排下序,尽量使得距离大的直接推到,这样贪心就好了 #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #include<string> #include<cmath> #include<map> #include<s原创 2016-07-31 13:09:24 · 360 阅读 · 0 评论 -
CF #364 (Div. 2) (B. Cells Not Under Attack 标记)
题目连接 在一个n*n的网格上,若果某个位置上放了一个棋子,那么棋子所在的行和列就算被覆盖了,每次放一个棋子问剩余的没有覆盖的点有几个使用,两个数组分别标记行和列,在用两个变量保存X集合的可用数,Y集合的可用数,那么放入一个棋子,检查下X,Y集合就好了#include<cstdio> #include<algorithm> #include<iostream> #include<vector> #原创 2016-07-28 08:21:38 · 272 阅读 · 0 评论 -
HDU5747 (Aaronson 贪心)
题目链接 贪心处理,每次减去最大的,需要注意的是数的范围的10^9,所以我们只要判断m最大到32就够了,因为2^32足够超过10^9了呀#include<cstdio> #include<algorithm> using namespace std; #define cl(a,b) memset(a,b,sizeof(a)) #define LL long long #define pb push原创 2016-07-24 10:24:28 · 503 阅读 · 0 评论 -
HDU5583 Kingdom of Black and White(连通块暴力)
题目链接 每次最多修改一个点。 按照连通区域进行计数,每次修改就是区域的端点 #include<bits/stdc++.h> using namespace std; #define LL long long #define cl(a,b) memset(a,b,sizeof(a)) #define pb push_backconst int maxn = 100005; const int i原创 2016-04-15 13:26:26 · 441 阅读 · 0 评论 -
计算机学院大学生程序设计竞赛(2015’11)
额,貌似都是暴力,除了油菜花那个用了数据结构。考验细心与编程能力。挺不错的 。1001,搬砖 题意:给你一个数字,把数字分为2半,代价是分开后二者的差值。要求最后全部是1。 解法:用dfs(n):表示把n分为2半需要的代价。//#define CF #ifndef CF #include<cstdio> #include<algorithm> #include<cstring> #include原创 2015-11-29 22:04:55 · 531 阅读 · 0 评论 -
Codeforces Round #331 (Div. 2)B. Wilbur and Array(规律)
题目链接 题意:有一个数组起始每一位都是0,然后你有两种操作,每次选择一个位置i,重i到n位置对应的数,都加一或者减一。问最小步数。 解法:考虑到前面的一个数操作必然引起后面的数变化,所以累加b数组相邻之间的差。 #include<bits/stdc++.h> using namespace std; #define LL long long #define pb push_back #defi原创 2015-11-16 11:13:23 · 388 阅读 · 0 评论 -
Codeforces Round #332 (Div. 2)C. Day at the Beach(好题,)
题目链接 题意:给你n个数,然后你把他们分块,然后每块有序后,整体就是有序的。问最多分几块。 解法:官方题解: Let’s take a minute to see how the best answer should look like. Let Hi be a sorted sequence of hi. Let E — set of indices of the last原创 2015-11-21 11:38:26 · 383 阅读 · 0 评论 -
Codeforces Round #327 (Div. 2) (C. Median Smoothing 找规律)
C. Median Smoothing time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A schoolboy named Vasya loves reading books on programming原创 2015-10-28 09:27:02 · 654 阅读 · 0 评论 -
HDU5510Bazinga(暴力剪枝)
题意:问是否存在最大的j在j之前的字符串中有一个不是j的子串, 思路,剪枝:如果一个串已经是某个串的子串,下次就可以不用再检查他了,还有一个,如果这个串前有比他长的串,那么就可以直接判断是ok的#include<bits/stdc++.h> using namespace std; #define LL long long #define pb push_back #define cl(a,b)原创 2015-11-04 20:15:28 · 300 阅读 · 0 评论 -
#1162 : 骨牌覆盖问题·三
#1162 : 骨牌覆盖问题·三 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 前两周里,我们讲解了2xN,3xN骨牌覆盖的问题,并且引入了两种不同的递推方法。 这一次我们再加强一次题目,对于给定的K和N,我们需要去求KxN棋盘的覆盖方案数。 提示:KxN骨牌覆盖 输入 第1行:2个整数N。表示棋盘宽度为k,长度为N。2≤K≤7,1原创 2015-05-03 10:48:51 · 848 阅读 · 0 评论 -
Gridland ZOJ1037(规律)
Gridland Time Limit: 2 Seconds Memory Limit: 65536 KB Background For years, computer scientists have been trying to find efficient solutions to different computing problems. For some of them ef原创 2015-04-28 13:13:44 · 1222 阅读 · 0 评论 -
B. Party
B. Party time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output n people came to a party. Then those, who had no friends among people原创 2015-04-08 13:19:40 · 861 阅读 · 0 评论 -
Codeforces Round #368 (Div. 2)(C. Pythagorean Triples 勾股数规律)
题目链接给出一个数,输出2个数,使得这三个数是勾股数形如2n,n^2-1,n^2+1可以组合成勾股数,这是偶数的情况 奇数的时候看个例子 3,4,5 4 = (1+3) * 1 5,12,13 12 = (1+5)*2 7,24,25 24 = (1+7)*3 9,40,41 40 = (1+9)*4 … 第二列数就是第一列数在以3为首项原创 2016-08-21 10:53:19 · 250 阅读 · 0 评论