自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

给我一把键盘

我还有很多想要完成的梦想。

  • 博客(57)
  • 收藏
  • 关注

原创 部分常用小功能模板【自用】

gcd最大公因数int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b);}Miller_Rabin 算法进行素数测试模板//特点:速度快、可以判断一个小于 2^63 的数是不是素数 const int S = 8; //随机算法判定次数一般 8~10 就够了//计算 ret = (a * b) % c a,b,c &...

2019-10-10 21:27:44 163

原创 Codeforces 1323B

Source1323B. Count SubrectanglesSolution给出两个长度为n和m的数组,让我们把他相乘,得到一个n×m的矩阵。然后给出一个k,让我们求出矩阵里,面积为k且数字全为1的矩形有多少个。对两个数组做前缀和,然后求出长度为x的种类有多少个,将k拆分成两个因数,设为a和b,所有的pre1[a] * pre2[b]即为所求。Code#pragma GCC optimize("Ofast")#pragma GCC target("avx,avx2,fma")#pragm

2020-09-12 08:44:30 168

原创 【笔记】HDU 6853 [2020hdu多校第七场1010]

SourceHDU 6853Solution求在坐标图上,随意游走,回到起点的概率。只能游走gcd(x,y) > 1的坐标。bfs跑全图,然后记录度。答案计算方式见Note.Note来源:HDU 2020 多校第七场 游记 ——WAautomatonCode/* * @Author: SolitaryOrz * @Date: 2020-08-19 17:29:23 * @Last Modified by: SolitaryOrz * @Last Modified time

2020-08-21 23:29:05 262

原创 hdu 6804【2020杭电多校赛第四场1003】【负值01背包】【random_shuffle】

Sourcehdu 6804 Contest of Rope PullingSolution有两个班级,一班有n个人,二班有m个人,每个人都有力气值和美丽值,从两个班分别选出力气之和相同的任意个人(可以全选也可以不选)。并使它们的美丽值最大。实际上我们可以把题目转化成01背包问题:n+m个物品,把力气作为cost,把美丽值作为value,一班的cost做负贡献,二班的cost做正贡献,最后取dp[0]即可。但是根据题目给出的数据范围,dp[x]的x范围最大为-106~106。我看了官方题解之后,才

2020-07-31 20:08:40 408 3

原创 HDU 6795【2020杭电多校赛第三场1005】【并查集】【组合数学】

Little W and ContestSourseHDU 6795 Little W and ContestSolution有两种人,读题的和写代码的,读题的人能力值是1,写代码的人能力值是2,组成一个团队最少需要能力5,所以至少要有2个写代码的人才能组成一个团队。团队里的人,任意两个人不能互相认识。每个回合教练都会介绍任意两个人认识(因此这两人不能在同一个团队里),并且认识的人之间具有传递性,即题目说明了a认识b,说明了b认识c,a就会视作认识c。问每个回合过后有多少种组成团队的方式。这种点

2020-07-29 19:03:06 174

原创 Codeforces 1247C 【思维】【2的幂】【二进制的特点】

C. p-binarySourceCodeforces 1247C p-binarySolution题意:把2k-p定义为2的k次幂,然后问最少需要多少个2的幂能够构成n.思路:首先枚举需要多少个2的幂,那么只用2的幂构成的数应该为m = n - i * p,然后判断m最少需要由多少个2的幂组成,把m转换成二进制,有多少个1即需要多少个2的幂组成,只要少于i(因为多余的可以把大拆小,如2...

2019-10-27 13:32:54 225

原创 记录2019CCPC厦门打铁

前言  这是第二次打铁了,第一次是今年的省赛,两次相距半年,感受也不太一样。第一次省赛打铁的时候,很难过,很自闭。这一次虽然很难过,但是并不迷茫。  省赛的时候,因为之前只是参加过校赛,在校赛里取得过相对还可以的成绩,其实并没有特别认真地去训练,把训练当作作业,完不成也罢。省赛打铁之后的一个星期整个人都比较消沉,也有思考过自己要不要继续走下去。最后斟酌过之后还是坚持了下来。流水账  暑假集...

2019-10-22 17:02:16 314

原创 Codeforces 1237C2 【几何】

C2. Balanced Removals (Harder)This is a harder version of the problem. In this version, n≤50000.There are n distinct points in three-dimensional space numbered from 1 to n. The i-th point has coordi...

2019-10-17 13:14:43 364

原创 Codeforces 1244C 【思维】【模拟】【暴力枚举】

C. The Football SeasonThe football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or ...

2019-10-16 20:05:45 241

原创 2019牛客国庆集训派对day1 G

ProblemG-字典序_2019牛客国庆集训派对day1Solution题目让你求的是,把原来的列数重新排位置,能够得到非递减字典序的序列。输出的是该位置安排的是原来的第几列,并且使你输出的内容是所有符合输出里面的最小字典序。如样例一:4 34 3 31 5 11 5 13 5 2答案为2 1 3重新排位置后得到的序列为:3 4 35 1 15 1 15 3 2...

2019-10-07 17:31:42 222

原创 Codeforces 1234B2

B2. Social Network (hard version)The only difference between easy and hard versions are constraints on n and k.You are messaging in one of the popular social networks via your smartphone. Your smart...

2019-10-02 23:36:00 334

原创 2019牛客国庆集训派对day1 E

ProblemE-Numbers_2019牛客国庆集训派对day1Solution把一个字符串分割成【0,99】之间的数,不能够有重复,问有多少种切法。如999可以分割成9和99或者99和9.解法就是对每一位数都进行dfs,每次选择一位或者两位往下继续dfs,如果不行则返回上一级,这样其实相当于是一种剪枝,当时以为会炸结果赛后跑了一遍发现能过,果然人不能太怂就是干。我的代码太丑了,贴一份...

2019-10-02 10:41:50 235 1

原创 HDU 5573 【贪心】

Binary TreeProblem DescriptionThe Old Frog King lives on the root of an infinite tree. According to the law, each node should connect to exactly two nodes on the next level, forming a full binary tr...

2019-09-30 19:35:52 120

原创 Codeforces 1221D 【DP】

D. Make The Fence Great AgainYou have a fence consisting of n vertical boards. The width of each board is 1. The height of the i-th board is ai. You think that the fence is great if there is no pair ...

2019-09-23 22:17:04 267

原创 Codeforces 1213D2 【思维】

D2. Equalizing by Division (hard version)

2019-09-21 17:30:58 196

原创 Codeforces 931E 【字符串】

E. Game with StringVasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an i...

2019-09-21 10:51:00 152

原创 Codeforces 931D 【DFS】

D. Peculiar apple-treeIn Arcady’s garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from ...

2019-09-21 09:57:14 187

原创 Codeforces 1191C【模拟】

C. Tokitsukaze and Discard ItemsRecently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she want...

2019-09-20 17:51:41 201

原创 Codeforces 1219C 【字符串构造】

C. Periodic integer numberAlice became interested in periods of integer numbers. We say positive X integer number is periodic with length L if there exists positive integer number P with L digits suc...

2019-09-18 21:11:51 354

原创 Codeforces 1136D 【思维】

D. Nastya Is Buying LunchAt the big break Nastya came to the school dining room. There are n pupils in the school, numbered from 1 to n. Unfortunately, Nastya came pretty late, so that all pupils had...

2019-09-18 00:06:13 165

原创 Codeforces 1136C

C. Nastya Is Transposing MatricesNastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task.Two matrices A and B are given, each ...

2019-09-14 10:49:25 839

原创 记录在ACM的第一年历程

2018年10月1日,第一次接触ACM  入学没多久便参加学校ACM协会组织的国庆新生欢乐赛,主要都是一些比较简单的思维题。可能相比大多数零基础的同学来说,高三的时候看过一点C primer plus,能够运用的知识会更多一点。可能也因此取得了相对还不错的成绩,也让我对这个又爱又恨的东西产生了兴趣。当我想不出题目该怎么做的时候真的恨得咬牙,但是一旦经过了思考解出了一道题就会非常有成就感。20...

2019-08-29 18:04:25 792

原创 BNUOJ 53073 【找规律】

萌萌哒身高差“清明时节雨纷纷,路上行人欲断魂。”然而wfy同学的心情是愉快的,因为BNU ACM队出去春游啦!并且,嗯。。。以下是wfy同学的日记:昨天,何老师告诉我们:明天我们去春游,大家准备好喝的和吃的哦!大家听了都兴奋起来,有的欢呼,有的鼓掌,开心得不得了。第二天,我们早早地来到学校,迫不及待地上了车,来到了公园。一进门,啊,太美了!公园中有那么多树,有高有矮,有粗有瘦,密密的,在春...

2019-08-22 17:26:44 214

原创 BNUOJ 53077 【字符串】【水】

命名规范问题驼峰命名法是起变量名的一种规范,大致来说是用混合的大小写字母来构成变量名,在这个问题里你可以假设具体规则如下:1.每个变量名由至少2个单词拼接构成,且每个单词长度至少为2;2.每个单词的首字母必须大写,其他位置必须小写(除了变量名的第一个单词允许全部小写外)。但是SK同学的英语很差,看到长长的变量名就很难脑补出是由哪些单词组成的,因此看驼峰命名法的代码十分头疼。还有一种下划线...

2019-08-22 16:48:30 117

原创 HDU 6693 [2019 Multi-University Training Contest 10]

Valentine’s DayProblem DescriptionOipotato loves his girlfriend very much. Since Valentine’s Day is coming, he decides to buy some presents for her.There are n presents in the shop, and Oipotato ca...

2019-08-22 10:16:34 380

原创 Codeforces 1185C2 【模拟】

C2. Exam in BerSU (hard version)The only difference between easy and hard versions is constraints.If you write a solution in Python, then prefer to send it in PyPy to speed up execution time.A sess...

2019-08-20 16:28:04 190

原创 HDU 6685 [2019 Multi-University Training Contest 9]

Rikka with CoinProblem DescriptionRikka hates coins, and she used to never carry any coins with her. These days, Rikka is doing her summer internship abroad. Without mobile payment, Rikka has to fac...

2019-08-20 13:03:34 182

转载 Codeforces 1194D 【博弈】

D. 1-2-K GameAlice and Bob play a game. There is a paper strip which is divided into n + 1 cells numbered from left to right starting from 0. There is a chip placed in the n-th cell (the last one).P...

2019-08-17 16:20:15 308

原创 Codeforces 847A 【思维】【模拟】

A. Union of Doubly Linked ListsDoubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the nex...

2019-08-17 00:24:23 338

原创 Codeforces 847B 【二分查找】

B. Preparing for Merge SortIvan has an array consisting of n different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array wit...

2019-08-16 21:35:56 205

原创 HDU 6656 [2019 Multi-University Training Contest 7]

Kejin PlayerProblem DescriptionCuber QQ always envies those Kejin players, who pay a lot of RMB to get a higher level in the game. So he worked so hard that you are now the game designer of this gam...

2019-08-15 14:38:49 136

原创 Codeforces 1203D2

D2. Remove the Substring (hard version)The only difference between easy and hard versions is the length of the string.You are given a string s and a string t, both consisting only of lowercase Latin...

2019-08-15 14:19:05 369 1

原创 HDU 6659 [ 2019 Multi-University Training Contest 8]

Acesrc and Good NumbersProblem DescriptionAcesrc is a famous mathematician at Nanjing University second to none. Playing with interesting numbers is his favorite. Today, he finds a manuscript when c...

2019-08-15 10:26:55 283

原创 Codeforces 1200C 【水题】

C. Round CorridorAmugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by m sectors. A wa...

2019-08-13 14:32:54 367

原创 HDU 6651 [2019 Multi-University Training Contest 7]

Final ExamProblem DescriptionFinal Exam is coming! Cuber QQ has now one night to prepare for tomorrow’s exam.The exam will be a exam of problems sharing altogether m points. Cuber QQ doesn’t know a...

2019-08-13 10:23:16 202

原创 HDU 6638 [2019 Multi-University Training Contest 6]

Snowy SmileProblem DescriptionThere are n pirate chests buried in Byteland, labeled by 1,2,…,n. The i-th chest’s location is (xi,yi), and its value is wi, wi can be negative since the pirate can add...

2019-08-08 14:50:20 154

原创 HDU 6628 [2019 Multi-University Training Contest 5]

permutation 1Problem DescriptionA sequence of length n is called a permutation if and only if it’s composed of the first n positive integers and each number appears exactly once.Here we define the ...

2019-08-06 14:59:59 254

原创 HDU 6630 [2019 Multi-University Training Contest 5]

permutation 2Problem DescriptionYou are given three positive integers N,x,y.Please calculate how many permutations of 1∼N satisfies the following conditions (We denote the i-th number of a permutat...

2019-08-06 09:54:11 433

原创 HDU 6579 [2019 Multi-University Training Contest 1]

OperationProblem DescriptionThere is an integer sequence a of length n and there are two kinds of operations:0 l r: select some numbers from al…ar so that their xor sum is maximum, and print the ma...

2019-08-03 16:20:11 137

原创 HDU 6601 [2019 Multi-University Training Contest 2]

Keen On Everything But TriangleProblem DescriptionN sticks are arranged in a row, and their lengths are a1,a2,…,aN.There are Q querys. For i-th of them, you can only use sticks between li-th to ri-...

2019-08-02 17:07:43 136

空空如也

空空如也

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

TA关注的人

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