- 博客(208)
- 收藏
- 关注
原创 F - Shift and Inversions
F - Shift and Inversions题目大意给你n个0到n-1全排列的数组,然后这个数组会循环左移n-1问你这个过程中数组的逆序数对是多少逆序数对,满足i<j, ai>aj 的对<i,j>的个数2≤N≤3×1e5思路初始的逆序对ans用树状数组或者归并排序做,这里就用树状数组的了,然后比如{2, 0, 1, 3}这个对循环左移变成了{0, 1, 3, 2},就是2往后移了,那么现在,比2的数移到了左边,逆序对就少了a1对,比2大的数也移到了左边,逆序对就多
2021-01-31 13:50:33
333
原创 ZCMU 5123: 分糖果
5123: 分糖果Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 26 Solved: 16[Submit][Status][Web Board]Description旧的一年过去,小明的生日(1月11号,小光棍节)又快到了,作为母胎单身的他打算脱单,于是他便准备开一个party来暗中相亲(想想都知道不可能成功的)。他为了能吸引到更多的女生,于是事先准备了好多糖果,准备派发给来party的每个人。可是一个难题摆在了他面前,他现在还无法确定到时候究竟会
2021-01-28 00:32:27
356
1
原创 ZCMU 5122: 小何的旅行I
5122: 小何的旅行ITime Limit: 1 Sec Memory Limit: 128 MBSubmit: 22 Solved: 12[Submit][Status][Web Board]Description有一天小何来到一个陌生的星球上旅游,但这边的钱币上印有奇奇怪怪的符号和字母,小何看不懂,但他又想买东西(不吃东西要饿死的!),而你是在那个星球上唯一认识的人,于是就找来你帮他翻译下。这个星球上不同的种族分别收不一样币种的钱币,而小何想买的东西也来自不同种族所开的店铺,因此他想知
2021-01-28 00:09:02
1392
1
原创 ZCMU:5121: 打印机队列
5121: 打印机队列Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 13[Submit][Status][Web Board]Description老师办公室有一台神奇的打印机,而打印机的打印顺序则是一个队列。这个队列比较神奇,它能根据任务的优先级分配打印任务。所有的任务有1-9的优先级(9的优先程度大于1),这个打印机的运作方式如下:现有n堆有顺序的打印任务(每一个自己的任务都有自己的优先级),他们首先会按顺序进入打印队
2021-01-27 00:07:18
788
1
原创 ZCMU:5120: 名单
5120: 名单Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 29 Solved: 20[Submit][Status][Web Board]Description小李是学生会的一名干部,在招新的时候他得到了一张有n个新生的名单,但由于办公室的干部们的粗心,这张名单上出现了很多重复的信息。小李很苦恼,于是想寻求你的帮助,帮他把这个名单按照原来的顺序(若遇到重复的信息,只要输出第一个就行,之后的就不需要输出了),留下不重复的信息。Input第一行
2021-01-26 20:47:42
904
原创 ZCMU 5119: Fibonacci_I
5119: Fibonacci_ITime Limit: 1 Sec Memory Limit: 128 MBSubmit: 44 Solved: 17[Submit][Status][Web Board]Description小P是一个数学爱好者,这天他打算研究一下斐波那契数列。他想知道第ii个斐波那契数ai是多少。斐波那契数列是这样的:1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 …比如,第3个数字是2,第5个数字是5,以此类推。但有一个问题,
2021-01-26 19:30:02
365
原创 ZCMU 5118: Tree!
5118: Tree!Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 21 Solved: 10[Submit][Status][Web Board]Description小M是一个图形爱好者,圣诞节快到了,他想用计算机画出一颗好看的圣诞树作为圣诞节礼物给他的女朋友(他其实没有女朋友,他只是在做梦),可他的智商有限,画不出一颗完美的圣诞树,因此,他需要你的帮助。一棵树由多个三角形和一个长方形树干组成,输入一个数字n,代表这棵树的层数。一棵树的第一
2021-01-26 16:37:43
213
原创 ZCMU 5117: Simple Parenthesis Matching
5117: Simple Parenthesis MatchingTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 52 Solved: 21[Submit][Status][Web Board]DescriptionGiven a string P only consist of characters with (), [] and {}. Now BaoBao wants to know whether P can form a valid bra
2021-01-26 16:17:37
172
原创 ZCMU 5116喝奶茶
5116: 喝奶茶Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 63 Solved: 20[Submit][Status][Web Board]Description小wh是20级医信的助教,有一天群里大伙起哄要喝奶茶。小wh家里很有钱,他觉得给每个人只买一杯奶茶有点体现不出他的壕气,所以他打算给第i个人买ai杯奶茶。但是他班上的同学也想知道有多少个人得到的奶茶会比他多。他们一直在问作为班助的小李,小李很苦恼,于是来寻求你的帮助。Input输入
2021-01-26 15:52:59
974
原创 PAT 1104 Sum of Number Segments (20分)
PAT 1104 Sum of Number Segments (20分)(不会失精度)真正的ac代码Code:#include<bits/stdc++.h>using namespace std;#define ll long longtypedef unsigned long long ull;int main(){ ll n; scanf("%lld",&n); ll sum=0; for(ll i=1; i<=n; i++
2020-12-01 17:29:51
77
原创 牛客练习赛67 E-牛妹游历城市
牛客练习赛67 E-牛妹游历城市链接:https://ac.nowcoder.com/acm/contest/6885/E来源:牛客网题目描述最近,牛妹天天宅在家里,真是憋死人了。他决定出去旅游。输入描述:本题有多组数据。第一行,输入一个数T,表示数据组数。接下来2*T行,先输入一个数n,再输入n个数,第i个数表示a i。输出描述:对于每组数据,输出最小的行走距离。如果无法从1号点到达n号点,则输出“Impossible”(不含引号)。示例1输入262 3 5 8 13
2020-08-17 14:42:08
323
原创 牛客练习赛67 D-牛妹爱数列
牛客练习赛67 D-牛妹爱数列链接:https://ac.nowcoder.com/acm/contest/6885/D来源:牛客网他手里有一个长度为n的序列a,保证它是一个01序列,并执行以下两种操作:1.单点修改:将位置x上的数翻转(0变1,1变0);2.前缀修改:将位置1~x上的数翻转(每个数都0变1,1变0)。他现在想要最小化翻转次数,使得数列上的所有数都变为0。链接:https://ac.nowcoder.com/acm/contest/6885/D来源:牛客网输入描述:第一行
2020-08-16 15:16:15
295
原创 HDU6862 Hexagon(2020杭电暑期多校训练第八场)
HexagonTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 167 Accepted Submission(s): 101Special JudgeProblem DescriptionIt is preferrable to read the pdf statment.If the world is a hexagon, I
2020-08-14 13:42:57
303
原创 HDU 6860 Fluctuation Limit(2020杭电多校暑期训练第八场)
Fluctuation LimitTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 268 Accepted Submission(s): 123Special JudgeProblem DescriptionIt is preferrable to read the pdf statment.Cuber QQ has signe
2020-08-14 13:17:43
248
原创 HDU 6857 Clockwise or Counterclockwise(2020杭电暑期多校训练第八场)
Clockwise or CounterclockwiseTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 112 Accepted Submission(s): 86Problem DescriptionIt is preferrable to read the pdf statment.After some basic geom
2020-08-14 09:40:15
158
原创 HDU 6828 Little Rabbit‘s Equation(2020杭电多校训练第六场)
Little Rabbit’s EquationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 593 Accepted Submission(s): 285Problem DescriptionLittle Rabbit is interested in radix. In a positional numeral system, t
2020-08-11 09:48:29
205
原创 K-The Flee Plan of Groundhog 2020牛客暑期多校训练营(第九场)
K-The Flee Plan of Groundhog题意:有一个土拨鼠在节点1,一个橘子在节点n,在t时刻之前土拨鼠向着n走,橘子不动,从t时刻开始,橘子开始抓土拨鼠,土拨鼠开始跑,土拨鼠 1m/s 橘子 2m/s,问还有多长时间橘子才能抓到土拨鼠。解题思路:t 时刻之后,土拨鼠必然朝着n的反方向移动,土拨鼠走一步,橘子走两步,那么我们可以记录一下t时刻土拨鼠的位置,还有土拨鼠向反方向最多能跑多远。然后分两种情况:土拨鼠向后跑到头了,等着被抓,那么显然答案是橘子到该点的距离/2向上取
2020-08-10 10:48:23
157
原创 I-The Crime-solving Plan of Groundhog2020牛客暑期多校训练营(第九场)
I-The Crime-solving Plan of Groundhog2020牛客暑期多校训练营(第九场)链接:https://ac.nowcoder.com/acm/contest/5674/I来源:牛客网题目描述Today, ZLZX has a mysterious case: Orange lost his down jacket hanging in his dorm room. Under the expectations of everyone, detective Groundh
2020-08-09 14:09:56
145
原创 F-Groundhog Looking Dowdy2020牛客暑期多校训练营(第九场)(尺取法)
F-Groundhog Looking Dowdy2020牛客暑期多校训练营(第九场)链接:https://ac.nowcoder.com/acm/contest/5674/F来源:牛客网Groundhog finds that Apple seems to be less intimate than before.He is very distressed for this.After pondering for a long time, Groundhog finds that he looks
2020-08-09 14:03:17
145
原创 E-Groundhog Chasing Death2020牛客暑期多校训练营(第九场)
链接:https://ac.nowcoder.com/acm/contest/5674/E来源:牛客网示例1输入1 2 1 2 8 4输出2048示例2输入1 2 3 4 120 180输出235140177备注:0⩽a,b,c,d⩽3×106 ,0<x,y⩽109 ,a⩽b,c⩽d.题意:求题解:这道题的思路历程真的是非常的久非常的久了,首先需要知道一个前提gcd的求法。比如30分解质因子是21*31*51,84的分解质因子是22*31*71.gcd(3
2020-08-09 11:28:19
152
原创 A-Groundhog and 2-Power Representation(2020牛客暑期多校训练营(第九场))
A-Groundhog and 2-Power Representation(2020牛客暑期多校训练营(第九场))输入描述:Given a string, indicating the power representation.输出描述:Output the original number.输入2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)输出1315题意就是算这个输入公式的结果这里提供一个python的做法,还有很多c++的做法可
2020-08-09 10:04:43
178
原创 HDU6831 Fragrant numbers(区间dp)2020杭电多校第六场
HDU6831 Fragrant numbers(区间dp)2020杭电多校第六场Sample Input352012Sample Output612题意:“1145141919” 的无穷串,给出一个n,要求选最少的num,使得前num个数中间添加任意括号、加号、乘号,计算结果等于n。题解:区间dp+预处理dp[i][j][val]:[i,j]区间内是否能计算出valval。于是可得转移方程:dp[i][j][v1+v2]=dp[i][mid][v1]+dp[mid+1
2020-08-07 13:06:39
192
原创 2020上海高校程序设计竞赛暨第18届上海大学程序设计联赛夏季赛(同步赛)
链接:https://ac.nowcoder.com/acm/contest/6871/A来源:牛客网A 同源例如,有三个正整数 a, b, c 和某一个目标值 k,如果 gcd(a,b)=gcd(b,c)=gcd(a,c)=k,并且 a,b,c!=k,那么他认为这三个数是一组好数。 其中gcd(x,y)表示整数 x 和 y 的最大公约数。当然这不够刺激。现在 Compute 想要知道,如果已知三个数的和 n 和目标值 k,是否存在一组 a, b, c 可以让它们是一组好数。链接:https://
2020-08-07 09:08:04
688
原创 数论合集
扩展欧几里德ll exgcd(ll a,ll b,ll &x,ll &y){ if(b==0){ x=1; y=0; return a; } else{ ll r=exgcd(b,a%b,x,y); ll t; t=x; x=y; ...
2020-08-07 09:00:18
181
原创 牛客编程巅峰赛S1第3场 - 青铜&白银
A-位数求和链接:https://ac.nowcoder.com/acm/contest/6220/A来源:牛客网牛牛想知道所有的长度为n的数中,各个位上的数字之和为m的这些数的和是多少呢。给定n和m,求这些数的和。C++(暴力模拟)class Solution {public: /** * 返回这样的数之和 * @param n int整型 数的长度 * @param m int整型 各个为之和 * @return long长整型 *
2020-08-07 08:59:42
155
原创 HDU6759 Leading Robots(杭电多校第一场)
Leading RobotsHDU6759 Leading RobotsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1811 Accepted Submission(s): 504Problem DescriptionSandy likes to play with robots. He is going to organiz
2020-08-07 08:59:20
233
原创 2020牛客暑期多校训练营(第八场) I-Interesting Computer Game
I-Interesting Computer Game题意详细题解有两个数组{a1,a2,a3,an},{b1,b2,b3,bn}第i步可以从ai和bi中取出一个值求最终取出不同的数的最多个数Code:离散化是因为ab 的范围太大了,所以按他们的大小排序,离散化#include<iostream>#include<cstdio>#include<cstring>#include<stack>#include<algorithm&g
2020-08-05 10:32:47
176
原创 K-Kabaleo Lite 2020牛客暑期多校训练营(第八场)
输入232 -1 33 2 143 -2 3 -14 2 1 2输出Case #1: 3 8Case #2: 4 13说明For test case 1, the maximum number of visitors is 3, one of apossible solution is: The first visitor received food 1, the profit is2. The second visitor received food 1, the pr.
2020-08-04 19:19:57
274
原创 2020牛客暑期多校训练营(第八场)G Game SET
链接:https://ac.nowcoder.com/acm/contest/5673/G来源:牛客网SET is a real-time card game designed by Marsha Falco in 1974 and published by Set Enterprises in 1991. The deck consists of 81 unique cards that vary in four features across three possibilities for each
2020-08-04 18:42:03
221
原创 HDU 6798 Triangle Collision(2020杭电多校训练第三场)
Triangle CollisionTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1091 Accepted Submission(s): 336Special JudgeProblem DescriptionSample Input44000 0 1732 1000 0 14000 0 1732 1000 0
2020-08-04 11:54:13
218
原创 I Parentheses Matching(2020杭电多校训练第三场)
I Parentheses Matching(2020杭电多校训练第三场)Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 792 Accepted Submission(s): 345Problem DescriptionGiven a string P consisting of only parentheses and aste
2020-08-02 18:22:49
196
原创 G Tokitsukaze and Rescue(2020杭电多校训练第三场)
Tokitsukaze and RescueTime Limit: 8000/8000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1315 Accepted Submission(s): 512Problem DescriptionPrincess CJB has lived almost her entire life in the isolated town of
2020-08-02 11:21:34
389
1
原创 2020牛客暑期多校训练营(第七场)B-Mask Allocation
2020牛客暑期多校训练营(第七场)B-Mask Allocation链接:https://ac.nowcoder.com/acm/contest/5672/B来源:牛客网Nowadays, the Kingdom of Dreamgrid is suffering from a national pandemic. Fortunately, president Baobao is working effectively with the Center for Disease Control (CDC
2020-08-01 21:55:10
1172
原创 2020牛客暑期多校训练营(第七场)H Divding
2020牛客暑期多校训练营(第七场)H Divding链接:https://ac.nowcoder.com/acm/contest/5672/H来源:牛客网题目描述The following rules define a kind of integer tuple - the Legend Tuple:(1, k) is always a Legend Tuple, where k is an integer.if (n, k) is a Legend Tuple, (n + k, k) is
2020-08-01 20:49:49
228
原创 2020牛客暑期多校训练营(第七场)D Fake News
2020牛客暑期多校训练营(第七场)D Fake News链接:https://ac.nowcoder.com/acm/contest/5672/D来源:牛客网McDonald Thumb, the greatest president ever in the history of the Great Tokitsukaze Kingdom has held his 100th press conference about the global pandemic after making his 10
2020-08-01 18:02:58
214
原创 HDU 6795 Little W and Contest(2020杭电多校第三场)
Little W and ContestTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1220 Accepted Submission(s): 407Problem DescriptionThere are n members in our ACM club. Little W wants to select three pers
2020-07-31 20:35:09
164
原创 2020牛客多校第六场H-Harmony Pairs(数位dp)
H-Harmony Pairs(数位dp)题意:S(A)表示数字A的每一位数的和,S(24)=2+4=6,S(209)=2+0+9=11求0到N中有多少对AB,使得S(A)>S(B) ,0<=A<=B<=N<=10100数位dp裸题,挺暴力的 dp[pos][sta][l1][l2]。其中pos表示枚举到的下标sta表示到pos之前AB的差值之和,为了避免出现负数,可以将其离散到999l1表示A取数的上界 l2表示B取数的上界sta-i+j是因为S(A)&g
2020-07-31 15:09:20
366
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人