自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 2018南京icpc区域赛——I - Magic Potion Gym - 101981I

Problem I. Magic PotionInput file: standard inputOutput file: standard outputThere are n heroes and m monsters living in an island. The monsters became very vicious these days,so the heroes decided to diminish the monsters in the island. However, the i

2020-11-23 20:49:42 167

原创 素数筛

#define maxn 10000000bool vis[maxn];int prime[maxn],x;void isprime(int n) //埃氏筛{for(int i=2;i<=n;i++){if(!vis[i]) prime[x++]=i;for(int j=2;ji<=n;j++){vis[ij]=true;}}}void oulasai(int n) //欧拉筛{for(int i=2;i<=n;i++){if(!vis[i]) pr

2020-11-23 20:27:29 120

原创 2018 icpc 南京区域赛-J - Prime Game Gym - 101981J

思路:对于第二个样例:第一个数字6的素因子2的贡献区间有[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[1,8],[1,9],[1,10] 共10个区间第一个数字6的素因子3的贡献区间有[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],[1,8],[1,9],[1,10] 共10个区间所以当前sum = 10+10;第二个数字7的素因子7的贡献区间有[1,2],[1,3],[1,4],[1,5],[1,6],[1,7],..

2020-11-23 20:24:12 150

原创 强连通分量

https://www.cnblogs.com/ljy-endl/p/11562352.html

2020-11-17 20:33:01 119

原创 string 函数的基本用法

https://blog.csdn.net/manonghouyiming/article/details/79827040

2020-11-17 20:28:48 130

原创 二分图最大匹配,最小边覆盖,最小点覆盖

详细解释和证明请看下面的博客https://blog.csdn.net/Flynn_curry/article/details/529662831.最小点覆盖是一个点集,满足所有的边至少有一个端点在点集中的最小点集,即点集里的点能覆盖所边;最小点覆盖 = 最大匹配;2.最小边覆盖是一个边集,满组边集里的点能覆盖所有端点;最小边覆盖 = 顶点数 - 最大匹配;3.最大独立集是一个点集,点集里的所有点两两都不能连在一起;最大独立集 = 顶点数 - 最大匹配;...

2020-10-25 13:16:33 327

原创 map函数基本操作和unordered_map函数

基本操作https://blog.csdn.net/sevenjoin/article/details/81943864?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.c

2020-10-24 16:45:06 156

原创 I - Invoking the Magic Gym - 102770I补题

BaoBao is a lazy boy. He has nn pairs of socks in different colours and he washes them once a month. In the washing machine, these socks will be mixed.Because there are too many socks that need to be paired, BaoBao divides the whole sock pairing process i

2020-10-24 15:09:46 746

原创 unique 用法

https://www.cnblogs.com/wangkundentisy/p/9033782.html详细算法去看这位博主的博客

2020-10-24 13:32:15 257

原创 A - AD 2020 Gym - 102770A补体

2020 is the current year and is a leap year starting on Wednesday of the Gregorian calendar, the 2020th year of the Common Era (CE) and Anno Domini (AD) designations, the 20th year of the 3rd millennium, the 20th year of the 21st century, and the 1st year

2020-10-23 21:23:42 907

原创 c++ isalpha、isalnum、islower、isupper用函数用法

1.isalphaisalpha()用来判断一个字符是否为字母,如果是字符则返回非零,否则返回零。2.isalnumisalnum()用来判断一个字符是否为数字或者字母,也就是说判断一个字符是否属于az||AZ||0~9。3.islowerislower()用来判断一个字符是否为小写字母,也就是是否属于a~z。4.isupperisupper()和islower相反,用来判断一个字符是否为大写字母。...

2020-10-21 20:17:00 459

原创 最小生成树prim算法和Kruskal算法总结

最小生成树prim算法和Kruskal算法总结部分转载于大佬 华山大师兄的博文,图片未copy,想通过图片进一步理解最小生成树算法的同学可以去看大犇的博文链接:https://www.cnblogs.com/biyeymyhjob/archive/2012/07/30/2615542.htmlPrim算法1.概览普里姆算法(Prim算法),图论中的一种算法,可在加权连通图里搜索最小生成树。意即由此算法搜索到的边子集所构成的树中,不但包括了连通图里的所有顶点(英语:Vertex (graph the

2020-10-16 21:10:43 391

原创 字符串最小循环节,kmp

字符串最小循环节就是组成字符串的最小循环子串,例如组成字符串ababab的最小循环节就是ab,组成字符串abcdabcdbc的最小循环节就是abcd,具体求法是字符串长度len-next[len] (next[0] = -1);具体原理可参考博客: https://blog.csdn.net/hao_zong_yin/article/details/77455285...

2020-10-16 21:06:15 1139

原创 三角形内切圆和外接圆半径及其面积计算

内切圆半径:r=2 * S / (a + b + c),其中S是三角形面积,a、b、c是三角形三边。外接圆半径:R=a * b * c / (4 * S)S可以用海伦公式S = (p(p - a)(p - b)(p - c))^(1/2)算得p = (a + b + c)/2对于不同的场合,每个公式都有自己的优势,若是已知三个顶点坐标a(x1,y1), b(x2,y2), c(x3,y3),若要求三点围成的三角形的面积,对计算机而言这个公式应该是最适合的:S = 1/2 * |(x2 - x1)

2020-10-12 21:32:36 18951

原创 J - 程序设计:轻重搭配 计蒜客 - A2227 贪心

程序设计:轻重搭配n 个同学去动物园参观,原本每人都需要买一张门票,但售票处推出了一个优惠活动,一个体重为 x 的人可以和体重至少为 2x 配对,这样两人只需买一张票。现在给出了 n 个人的体重,请你计算他们最少需要买几张门票?输入格式第一行一个整数 n,表示人数。第二行 n 个整数,每个整数 ai​ 表示每个人的体重。输出格式一个整数,表示最少需要购买的门票数目。数据范围对于 30% 的数据:1≤n≤25,1≤ai≤100。对于 60% 的数据:1≤n≤10000,1≤ai≤1000。

2020-10-12 20:58:37 236

原创 B - 结果填空:炮台实验 计蒜客 - A2222(没理解)

转载自:https://blog.csdn.net/qq_43328040/article/details/88636582?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-4.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-4.c

2020-10-12 20:29:58 205

原创 求n!的位数

用log10(n)+1向下取整可以求n的位数,若要求n!的位数,可以用log10(n!)+1 = log10(1)+log10(2)+log10(3)+…+log10(n)+1 向下取整;例:蒜头君对阶乘产生了兴趣,他列出了前10个正整数的阶乘以及对应位数的表:nn!位数1 1 12 2 13 6 14 24 25 120 36 720 37 5040 48 40320 59 362880 610 3628800 7对于蒜头君来说,再往后就很难计算了。他试图寻找阶乘位数

2020-10-12 19:50:10 430

原创 2020-10-08 组队赛补题 M - Maratona Brasileira de Popcorn Gym - 102346M

Problem MMaratona Brasileira de PopcornThe “Maratona Brasileira de Popcorn” is a competition that takes place annually to find out whichteam is the most organized, prepared and well-trained in the art of eating popcorn. It is organized byBrazilian Soci

2020-10-09 21:03:05 166

原创 2020-10-8 组队赛补题 A - Artwork Gym - 102346A(并查集)

Problem AArtworkThe Mona Dura is one of the most valuable artworks in Nlogonia Museum. The famous painting isdisplayed in a rectangular room of M by N meters. The room entrance is in a corner of it, while theMona is in the corner diagonally opposite to

2020-10-09 20:19:22 239

原创 L - Largest Allowed Area Gym - 102091L 题解

L - Largest Allowed Area Gym - 102091L 题解题目A company is looking for land to build its headquarters. It has a lot of money and can buy asmany land patches as it needs. Its goal, however, is finding the largest square regioncontaining no forest. Unfortu

2020-09-30 21:04:14 73

原创 D - Detour Gym - 101666D 详解

Problem D: Detour9D DetourAfter last year’s edition of the BAPC, you are still stuckin Delft. In order to participate again this year, you aregoing to Amsterdam by bus. During the journey you lookout of the window and look for traffic signs that

2020-09-28 21:15:38 152

原创 I Irrational Division

I Irrational Division题意有一个p*q的黑白相间的格子图,你站在左边往右切,另一个人站在下边往上切,切到的部分黑色加1分,白色减1分,两人都按最优策略尽量让自己分最大,问最大可能的分数差值绝对值。分析显然分奇偶判断一下。当p为偶数,列无论怎么取都是黑白相同0,所以最优取法是保守取剩下偶数列,这样对方也只能保守取偶数行,最后答案为0。如果取剩下奇数列,那最后的得分是0和-2,虽然答案变大,但是并不是最优的使得两人得分尽量多的策略。当p为奇数,q也为奇数时,第一步保守取偶数列得分

2020-09-28 20:45:08 93

原创 2020-08-29 2020年SDUTACM暑假集训总结(计科1901郑延志)

2020年SDUTACM暑假集训阶段总结9#504计科1901郑延志一、学习内容–暑假新学了哪些专题,每个专题刷了多少题(1) 01背包,3题(2) 完全背包,1题(3) 多重背包,2题(4) 字典树,14题(5) 线段树基本操作,11题(6) 线段树扫描线,1题(7) 素数,4题(8) 欧拉函数,1题(9) 快速幂, 1题(10) 规律,2题(11) 调和级数,1题(12) Kmp, 2题(13) manacher, 2题(14) exkmp, 1题(15) 二分图最大匹

2020-08-29 14:12:49 155

原创 2020-08-18组队赛总结和longlong超时int不会超时的问题

这次比赛我们的默契度又有了提升,我们三个分别从前中后三个位置分别看题,在短时间内就完成了三道比较简单的题目。这套题其实是有难度的,所以在做完简单题目的时候再做其他题目的时候还是比较吃力的。这次还有一个意外的收获就是我们在做最后一道题是发现有些变量如果定义为long long就会超时,但是用int就不会超时,而且差距挺大的,前者用时一万秒也没运行完,后者只运行了一千多秒。局限于现在所知道的知识,而且我在网上也没发现相应的解释,所以这里只做个总结,就是如果题目中变量数据不是很大,在int范围内就用int,避免出

2020-08-18 20:15:57 351

原创 2020-08-11组队赛总结

/

2020-08-11 20:24:23 129

原创 2020-08-07vj个人赛比赛总结

vj个人赛我选择做了第一组,这组比赛相对比较难一些(当然是对于我这种弱鸡选手来说)不过这套题的价值相对更高一些。在这套题中,我只做出一道题,还有两道题感觉自己有思路,所以再8号我补了这两道题。收获还是很大的。这次比赛有几个题目对时间要求比较高,所以我要注意时间复杂度部分的分析和自己代码的优化。在后续的比赛中,我会更加认真。...

2020-08-08 15:00:47 184

原创 K - Assigning Frequencies UVALive - 8273

Bob wants to assign frequencies to n satellites, numbered from 0 to n−1. Two distinct satellites aresaid to be adjacent if, when assigned the same frequency, they interfere with each other. Sensibly,Bob’s assignment of frequencies must avoid interference

2020-08-04 21:11:30 119

原创 acm八月四号组队赛补题-A - Smooth Sequences UVALive - 8263

A sequence of n integers is called smooth, if the absolute values of the differences between successivenumbers are at most d. We call a non-smooth sequence semi-smooth, if we can change exactly onenumber in the sequence to make it smooth. For example, le

2020-08-04 21:07:20 124

原创 第二次组队赛比赛总结

今天参加了第二次组队赛,效率比上次提高了很多,这次我们选择谁有思路去写代码,其他队友去看其他题目,然后我们一起去检查代码的正确性,然后提交代码,这样效率明显有了提高。在这次组队赛中,我的队友真的是各显神通,他们总是能在第一时间想出题目的思路,然后我们去和我们分享寻找解题方法。然后当代码里存在bug的时候,会将自己写的代码发到群里然后我们也总有人能找到bug所在,这比起个人赛里一个人为找不到bug而苦恼真的好了太多。我深刻地体会到集体的力量,然后我感到1+1+1真的可以大于三。我越来越喜欢和我的队友一起去解决

2020-07-30 21:19:57 174

原创 第二次组队赛补题--Problem H. Hash Code Hacker

Input file: hash.inOutput file: hash.outTime limit: 2 secondsMemory limit: 256 megabytesAccording to Java standard library documentation, the hash code of String is computed ass [0]*31^( n -1) + s [1]*31^( n -2) + … + s [n -1]Here s[i] is the i-th ch

2020-07-30 21:10:50 211

原创 第二次组队赛补题Problem C. Concatenation**

补题**:Problem C. Concatenation**Input file: concatenation.inOutput file: concatenation.outTime limit: 2 secondsMemory limit: 256 megabytesFamous programmer Gennady likes to create new words. One way to do it is to concatenate existingwords. That means

2020-07-30 20:02:31 167

原创 VJ F - I am bored

Being a judge is not always an interesting job! For example, it is very boring to wait for the first submission in the contest. So, judges used to entertain themselves using the “I’m Bored” tab in the PC 2 software. In this tab, a button is shown and you n

2020-06-03 20:44:50 234

原创 J - MaratonIME goes to the japanese restaurant (again)

J - MaratonIME goes to the japanese restaurant (again)Nakato?from MaratonIME, MembersAfter a long day of hard training, MaratonIME (マラトニメ) members decided to go to a Japanese restaurant. Yeah, we love Japanese food.After a lot of sushi boats, when ever

2020-05-12 16:40:31 401

原创 F. Travelling Salesman

VJ 补提F. Travelling SalesmanAfter leaving Yemen, Bahosain now works as a salesman in Jordan. He spends most of his time travellingbetween different cities. He decided to buy a new car to help him in his job, but he has to decide about thecapacity of the

2020-05-12 16:18:04 173

原创 K. Runtime Error

VJ 补题K. Runtime ErrorBahosain was trying to solve this simple problem, but he got a Runtime Error on one of the test cases, can youhelp him by solving it?Given an array of Nnon-negative integers and an integer K, your task is to find two integers Xand

2020-05-12 16:09:17 254

原创 J. Candy

VJ 补题J. CandyBahosain went back for teaching but now in a primary school. His classes, which contain a total of Nstudents,went to a school trip. Bahosain has Mpackets of candies; each packet contains one or more candies.Students think that a distributi

2020-05-12 15:55:32 169

原创 E - MaratonIME does (not do) PAs

VJ 补题E - MaratonIME does (not do) PAs思路:用贪心的思路,因为最终减去的值就是所有截止时间的和,所以截止时间不用做处理,只需要把每个题目的罚时从小到大排序然后进行处理,最后减去截止时间的和老规矩,错误代码奉上:#include<bits/stdc++.h>#includeusing namespace std;void qs(int a[],int l, int r){int i = l, j = r, key1 = a[l];if(l&g

2020-05-12 15:42:05 148

原创 C - MaratonIME eats japanese food

VJ 补题 C - MaratonIME eats japanese foodAfter a long time eating japanese food, the members of MaratonIME are getting really good at it. Nowadays, a massive amount of japanese food is eaten by the group and it’s often difficult to find space for all the p

2020-05-12 14:47:19 442

原创 __gcd(x,y)函数的用法和符号&的三种用法

1 : __gcd(x,y)是algorithm库中的函数用来求解x,y的最大公约数2:一个是取变量的地址来.如int a =5;int *p = &a;printf("%d",*p); // 5二是按位与(可以用来判断一个数是否为偶数//if(x&1))如int a =5;int b =2;int c=a&b ;// c =0101 & 0010 = 0000 = 0; 算术运算三是自 && 表示或者 逻辑zhidao 运算c = a&

2020-05-11 23:27:28 1268

转载 浅析求两个数的最大公约数的三种算法

浅析求两个数的最大公约数的三种算法1.最大公约数(最大公因数)就是几个数公有的因数中最大的一个。例:12与18 12的因数有1,12,2,6,3,418的因数有1,18,2,9,6,3公有的因数有1,2,3,6, 所以6就是12与18的最大公约数.而求最大公约数的方法可以总结为:1)更相减损法:更相减损术, 出自于中国古代的《九章算术》,也是一种求最大公约数的算法。①先判断两个数的大小,如果两数相等,则这个数本身就 是就是它的最大公约数。②如果不相等,则用大数减去小数,然后用这个较小数与它们

2020-05-11 23:21:11 1150

空空如也

空空如也

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

TA关注的人

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