
tricks
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【HDU - 3714 】Error Curves (三分)
题干:Josephina is a clever girl and addicted to Machine Learning recently. She pays much attention to a method called Linear Discriminant Analysis, which has many interesting properties. In order t...原创 2018-08-01 22:15:34 · 246 阅读 · 0 评论 -
【CodeForces - 706C】Hard problem(dp,字典序)
题干:Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help.Vasiliy is given n strings consisting of lowercase English letters. He wan...原创 2018-11-04 15:14:21 · 498 阅读 · 0 评论 -
【CodeForces - 246D】Colorful Graph (暴力,图,存边,STL)
题干:You've got an undirected graph, consisting of n vertices and m edges. We will consider the graph's vertices numbered with integers from 1 to n. Each vertex of the graph has a color. The color of ...原创 2018-11-08 17:37:10 · 356 阅读 · 0 评论 -
【 POJ - 2033 】Alphacode (dp,有坑)
题干:Alice and Bob need to send secret messages to each other and are discussing ways to encode their messages: Alice: "Let's just use a very simple code: We'll assign 'A' the code word 1, 'B' will ...原创 2018-11-15 20:20:14 · 309 阅读 · 0 评论 -
【CodeForces - 264A】Escape from Stones (模拟,卡精度的处理)
题干:Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, nstones will fall and Liss will...原创 2018-11-15 22:14:18 · 453 阅读 · 0 评论 -
【CodeForces - 260D】Black and White Tree (思维构造,猜结论,细节,构造一棵树)
题干:The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles.Each node of the gr...原创 2018-11-14 16:40:09 · 480 阅读 · 0 评论 -
【POJ - 2909 】Goldbach's Conjecture (哥德巴赫猜想,数论,知识点结论)
题干:For any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such thatn = p1 + p2This conjecture has not been proved nor refused yet. No one is ...原创 2018-11-12 21:07:08 · 569 阅读 · 0 评论 -
【牛客 - 301哈尔滨理工大学软件与微电子学院第八届程序设计竞赛同步赛(高年级 )】小乐乐和25(模拟,技巧)
题干: 小乐乐特别喜欢25这个数字,他想把所有的数字都变成25的倍数。现在小乐乐得到一个数字,想问问你最少用几次操作才可以把这个数字改造成25的倍数。对于一次操作我们可以把相邻的两位做交换,比如123经过一次操作之后就可以变成213或者132。 输入描述:多组数据输入对于每组数据,只有一行输入一个整数n(1 <= n <= 1000000000)。输出描...原创 2018-12-05 00:37:26 · 395 阅读 · 0 评论 -
【牛客 - 303K第十五届浙江大学宁波理工学院程序设计大赛(同步赛)】Technology Tree(树形dp,tricks)
题干: 在星际争霸(StarCraft)中,有3个种族。对于任意一个种族,他们的建筑建造都是有一个顺序的。这个顺序正好是一个树形结构,我们称之为"科技树"(Technology tree)。在科技树中,只有一个建筑是不需要前置建筑的,我们把这个建筑的编号设为1。其他的建筑,有且仅有一个前置建筑。比如建筑2的前置建筑为建筑1,意思是只有先建造了建筑1,才能建造建筑2。一个种族有n个...原创 2018-12-09 10:41:11 · 283 阅读 · 0 评论 -
【CodeForces - 472A】Design Tutorial: Learn from Math (tricks,思维,数论,打表)
题干:One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a s...原创 2019-01-22 00:33:16 · 272 阅读 · 0 评论 -
【CodeForces - 768C】Jon Snow and his Favourite Number(思维,技巧,套路,数学异或,循环节,trick)
题干:Jon Snow now has to fight with White Walkers. He has n rangers, each of which has his own strength. Also Jon Snow has his favourite number x. Each ranger can fight with a white walker only if the...原创 2018-12-23 09:35:19 · 559 阅读 · 0 评论 -
【AtCoder - 4244 】AtCoder Express 2 (区间dp 或 暴力枚举,思维)
题干:In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses Mtrains, and the train i runs fro...原创 2018-10-29 23:49:15 · 429 阅读 · 0 评论 -
【HDU -1568】 Fibonacci(斐波那契通项公式+取对数)
FibonacciProblem Description2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2))的值全部给背了下来。接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超...转载 2018-09-11 11:46:55 · 687 阅读 · 0 评论 -
【CodeForces - 1027C】Minimum Value Rectangle (数学,公式化简,思维,卡常卡memset)
题干:You have nn sticks of the given lengths.Your task is to choose exactly four of them in such a way that they can form a rectangle. No sticks can be cut to pieces, each side of the rectangle must...原创 2018-10-18 00:34:00 · 382 阅读 · 0 评论 -
【HDU - 1850】Being a Good Boy in Spring Festival (尼姆博弈,nim,异或前缀和)
题干:一年在外 父母时刻牵挂 春节回家 你能做几天好孩子吗 寒假里尝试做做下面的事情吧 陪妈妈逛一次菜场 悄悄给爸爸买个小礼物 主动地 强烈地 要求洗一次碗 某一天早起 给爸妈用心地做回早餐 如果愿意 你还可以和爸妈说 咱们玩个小游戏吧 ACM课上学的呢~ 下面是一个二人小游戏:桌子上有M堆扑克牌;每堆牌的数量分别为Ni(i=1…M);两人轮流进行;每走一步可以任意选择一堆并...原创 2018-10-08 00:56:53 · 180 阅读 · 0 评论 -
【CodeForces - 660C】Hard Process (尺取 或 二分+滑窗,前缀和预处理)
题干:You are given an array a with n elements. Each element of a is either 0 or 1.Let's denote the length of the longest subsegment of consecutive elements in a, consisting of only numbers one, as f...原创 2018-10-19 01:03:51 · 562 阅读 · 0 评论 -
【CodeForces - 1066A~E】水题,模拟(有技巧),思维,题意难懂的模拟,二进制问题(有技巧)
A.题目大意: x坐标上1~L有L个点都是整数,每v个长度就有一个灯亮着,但是有 [ l , r ] 这段区间上有列火车挡住了,问你能看到多少亮灯。解题报告: 大水题啊,找几个样例就会发现需要特殊处理一下左边界恰好有灯的情况。AC代码:#include<bits/stdc++.h>using namespace std;int L,v,l,r,a...原创 2018-10-20 00:14:26 · 512 阅读 · 0 评论 -
【CodeForces - 195D】Analyzing Polyline (思维,卡精度的处理方式)
题干:As Valeric and Valerko were watching one of the last Euro Championship games in a sports bar, they broke a mug. Of course, the guys paid for it but the barman said that he will let them watch foo...原创 2018-10-20 21:56:22 · 398 阅读 · 0 评论 -
【CodeForces - 985D】Sand Fortress (二分,贪心,思维构造,技巧,有坑)
题干:You are going to the beach with the idea to build the greatest sand castle ever in your head! The beach is not as three-dimensional as you could have imagined, it can be decribed as a line of spo...原创 2018-10-20 22:53:39 · 682 阅读 · 0 评论 -
【POJ - 2785】4 Values whose Sum is 0 (二分,折半枚举)
题干:The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . In the fol...原创 2018-10-25 22:42:50 · 256 阅读 · 0 评论 -
【HDU - 2072 】单词数(字符串读入技巧,sstream大法,水题,字符串读入格式)
题干:lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没有标点符号,遇到#时表示输入结束。Output每组只输出一个整数,其单独成行,该整数代表一篇文章里不同单词的总数。Samp...原创 2018-10-29 21:25:10 · 289 阅读 · 0 评论 -
【Gym - 101196F】Removal Game (环形区间dp,环状,细节优化)
题干:健健开发了一个游戏叫做<<者护守形隐>>,里面有一个情节是这样的,女主子纯藤武被坏人关在了密室里,作为男主的肖健当然要英雄救美。但是要打开密室的门,必须解开一道谜题。门上有几个数字围成的一个圈,每次消除一个数字的代价是这个数字旁边的两个数字的gcd,当最后消的只剩两个数时,消除这两个数的代价就是这两个数字的gcd,密室的密码就是消除所有数字的最小代价。请你帮助...原创 2019-04-04 16:02:25 · 713 阅读 · 0 评论