
寒假练习题
文章平均质量分 66
LsFlyt
这个作者很懒,什么都没留下…
展开
-
ZOJ 3870 Team Formation
传送门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3870原创 2016-02-28 08:43:00 · 357 阅读 · 0 评论 -
CodeForces 622A Infinite Sequence
传送门:http://codeforces.com/problemset/problem/622/A有一个序列1 1 2 1 2 3 1 2 3 4……就是每次从1数到i(i>=1),求第n个数是多少显然将序列分组11 21 2 3……前k组共有k*(k+1)/2个,所以找到最大的k使,k*(k+1)/2话说,标准的二分怎么写啊代码如下:原创 2016-02-20 17:07:26 · 394 阅读 · 0 评论 -
CodeForces 616D Longest k-Good Segment
传送门:http://codeforces.com/problemset/problem/616/D对于给定的n个数的数列a,第k好的区间是一个区间中不同的数的个数不超过k,求一个最大长度的区间尺取法,还是扫描整个区间,如果当前的种类已经超过k了就让左端指针后移直到种类代码如下:#includeusing namespace std; int n,k原创 2016-02-20 17:13:44 · 428 阅读 · 0 评论 -
CodeForces 625C K-special Tables
传送门:http://codeforces.com/problemset/problem/625/C用1~n^2填充n*n的方阵,满足所有的数都使用了一次每一行的数是递增的第k列的数的和尽量大求满足的方阵贪心,将1~k-1列先竖着填充1~n*(k-1)的数,然后k~n列横着填充代码如下: #includeusing namespace s原创 2016-02-20 17:32:39 · 710 阅读 · 0 评论 -
CodeForces 618C Constellation
传送门:http://codeforces.com/problemset/problem/618/C已知若干的点的坐标,并且没有两个点坐标相同,所有点不会均在一条线上,求三个顶点构成的任意一个三角形,是其余的点都严格在三角形外。水题。。。结果因为数据范围WA了A1:按极角排序,所以第一个点,第二个点,和之后第一个不共线的点就是答案,因为数据范围,所以算叉乘的时候要用原创 2016-03-18 15:58:20 · 448 阅读 · 0 评论 -
ZOJ 3480 Duck Typing
传送门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3480大模拟代码如下:#include#include#include#include#includeusing namespace std; int T; int tot; map father; map s;原创 2016-02-20 21:18:59 · 537 阅读 · 0 评论 -
CodeForces 624D Array GCD
传送门:http://codeforces.com/problemset/problem/624/D题目大意:给一个序列,有两种操作1,删掉某一个连续区间,代价为区间长度*a2,把某些数+1或-1,代价为更改的数量*b对于1操作只能进行一次,2操作可多次,并且不能把整个序列删除使得序列的最大公约数大于1,求最小的代价因为不能把整个序列删除,所以s[1]与s[原创 2016-02-21 20:34:17 · 688 阅读 · 2 评论 -
poj 2096 Collecting Bugs
传送门:http://poj.org/problem?id=2096有n中bug,s个子程序,每种bug可视为有无限多个,每天检查一遍,求在每个程序中都找到bug,并且n种bug都找出来的期望天数又是dp+概率f[i][j]表示已经找出i个bug,并在j个程序中找到了bug则求得是f[0][0]已知f[n][s]=0则对于每一天的检查有四种结果找到了新的bu原创 2016-02-22 22:25:45 · 359 阅读 · 0 评论 -
CodeForces 227A Where do I Turn?
传送门:http://codeforces.com/problemset/problem/227/A就是给出来的点,当前的点,要去的点,判断向前还是向左还是向右水题,叉积好了代码如下:#includeusing namespace std; long long xa,ya,xb,yb,xc,yc;int main(){ scanf("%I64d%I6原创 2016-02-22 22:31:41 · 520 阅读 · 0 评论 -
HDU 5105 Math Problem
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5105给一个三次函数以及一个区间,求在该区间上三次函数的绝对值最大是多少最简单的情况a=0且b=0,则直接求两端点值并比较a=0而b!=0时,求两端点值,并且求导。。。a!=0是求导。。。没了反正就是高中数学的知识啦啦啦代码如下:#include#in原创 2016-02-22 22:34:17 · 298 阅读 · 0 评论 -
UVA 11134 Fabled Rooks
传送门:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2075已知n*n的棋盘上放置n个车,使得每个车不互相攻击,每个车只能放在某个矩形内输出一种方案,如果无解输出“IMPOSSIBLE”对于x,y轴可分开考虑,问题转化为在1原创 2016-02-22 22:39:05 · 458 阅读 · 0 评论 -
Gym 100015B Ball Painting
传送门:http://codeforces.com/gym/100015/attachments已知一个2*n的网格,按要求染色,第一个可以随便染,之后的必须和已经染色的相邻,斜着也算相邻,求染色方案数%1000000007还是dpf[i][j]表示i行j个,显然i然后f[i][j]从两个状态转移,一个是另开一行,有四个位置可以染色 f[i][j]+=f[i-1][原创 2016-03-20 10:43:03 · 423 阅读 · 0 评论 -
Gym 100015A Another Rock-Paper-Scissors Problem
传送门:http://codeforces.com/gym/100015/attachments已知一个石头剪刀布的串S初始是P每次构造串S‘打败S,以及S’‘打败S’以此类推求第n个元素是什么只要找到是哪个转移来的就行让x减去不大于x的最大的3的幂代码如下:#includeusing namespace std; long lo原创 2016-03-20 11:58:32 · 501 阅读 · 0 评论 -
HDU 5115 Dire Wolf
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5115森林狼嘛,2费11但是可以给相邻的随从加buff,hhh代码如下:#include#include#includeusing namespace std; int T; int n; int a[205],b[205]; int f[20原创 2016-02-22 21:24:47 · 418 阅读 · 0 评论 -
CodeForces 626E Simple Skewness
题目链接:http://codeforces.com/problemset/problem/626/E题目大意:有k个数,选若干个数,使这几个数的平均值-中位数最大,输出任意一种方案先排序从小到大然后枚举中位数,当然这个序列是包含奇数个数,为什么不是偶数个数,因为当是偶数的时候可以把中间两个数大的那个删掉,这样解会更优证明如下:然后,对于平均数-中位数,原创 2016-02-19 21:51:24 · 610 阅读 · 0 评论 -
CodeForces 626C Block Towers
题目链接:http://codeforces.com/problemset/problem/626/C题目大意:有n个人搭建高度以2为倍数的塔,有m个人搭建高度以3位倍数的塔, 高度不能相同,求最高的塔的最小值贪心好了,要是没有重复的情况的话就是min(2*n,3*m),但是还是不能相同,淦。。。首先nmax为n个人的最大值,mmax为m个人的最大值重复的地方相当于原创 2016-02-19 21:14:57 · 554 阅读 · 0 评论 -
ZOJ 3844 Easy Task
传送门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3844原创 2016-02-28 08:43:31 · 551 阅读 · 0 评论 -
HDU 2577 How to Type
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2577原创 2016-02-28 08:44:05 · 360 阅读 · 0 评论 -
SGU 104 Little shop of flowers
传送门:http://acm.sgu.ru/problem.php?contest=0&problem=104原创 2016-02-28 08:44:42 · 433 阅读 · 0 评论 -
POJ 3320 Jessica's Reading Problem
Jessica's Reading ProblemTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uDescriptionJessica's a very lovely girl wooed by lots of boys. Recently she has a原创 2016-02-15 21:25:18 · 534 阅读 · 0 评论 -
LightOJ 1422 Halloween Costumes
Halloween CostumesTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %lluDescriptionGappu has a very busy weekend ahead of him. Because, next weekend is Hallowee原创 2016-02-15 21:11:33 · 380 阅读 · 0 评论 -
CodeForces 625A Guest From the Past
Guest From the PastTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uDescriptionKolya Gerasimov loves kefir very much. He lives in year 1984 and knows all th原创 2016-02-15 21:28:46 · 628 阅读 · 0 评论 -
ZOJ 3502 Contest
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3502题目大意:对于n个题目每个题目答对的概率是之前答对的m道题r1,r2,r3....rm,取ar1r,ar2r,ar3r,...armr,arr的最大值求一个序列是答对题的期望最大,并输出方案字典序最小的那个。n只有10,考虑状压原创 2016-02-17 09:16:55 · 443 阅读 · 0 评论 -
UVA 7334 Kernel Knights
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5356题目大意,有2*n个骑士,骑士分为两组,每个骑士一定会唯一的攻击另一组中的某一个骑士,要求找到一个集合,是集合内的骑士互不攻击,集合外的骑士从被某些集合内的骑士攻击原创 2016-02-17 15:30:40 · 871 阅读 · 0 评论 -
ZOJ 3609 Modular Inverse
Modular InverseTime Limit:2000MS MemoryLimit:65536KB 64bit IO Format:%lld& %lluDescriptionThe modularmodular multiplicative inverse of an integer a modulo m isan integer x such that a-1≡原创 2016-02-15 20:10:59 · 466 阅读 · 0 评论 -
UVA 1451 Average
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4197题目大意:在01序列中找到一个长度不小于L的序列,使得该序列的平均值最大,输出区间端点,并保证左端点最靠左。求平均值也就是求(a[l]+a[l+1]+···+a[r]原创 2016-02-17 21:37:28 · 549 阅读 · 0 评论 -
CodeForces 620D Professor GukiZ and Two Arrays
A - Professor GukiZ and Two ArraysTime Limit:3000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uDescriptionProfessor GukiZ has two arrays of integers, a and b.原创 2016-02-14 21:46:17 · 950 阅读 · 0 评论 -
POJ 2886 Who Gets the Most Candies?
。。。原创 2016-02-18 16:59:37 · 339 阅读 · 0 评论 -
HDU 4602 Partition
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4602求把数n分解,一共有2^(n-1)种分法,其中k出现的次数相当于把n个物品分开,其中有一分为k分为两种情况前两种是一种。。。那么第一种情况方案数为原创 2016-02-19 20:12:18 · 463 阅读 · 0 评论 -
CodeForces 520E Pluses everywhere
传送门:http://codeforces.com/problemset/problem/520/E有一串n个数,在n个数中插入k个加号,拆成k+1个数,求着n*(k+1)的数的和是多少当然,暴力枚举是不可以的hhh,所以要考虑别的思路对于一个数12345相当于1*10^4+2*10^3+3*10^1+4*10^0所以只要考虑每一个数在每一位上的次数从低到高分别原创 2016-02-23 17:32:10 · 833 阅读 · 0 评论