自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 C. Joyboard

当插入第n+1的数的时候已经可以确定当前序列了,因为ai = ai+1 mod i。当k>3的时候没有n+1序列满足题意要求因为无论an+1取何值,an<n,(an = an+1 % n) 当遍历到 i = an+1%n 的时候 ai-1 = ai % i = 0;有n+1个槽,向这n+1个槽里面加n+1个数,限制第n+1个数不大于m,其中ai满足:ai = ai+1 mod i,然后保证插入的这n+1个数刚好有k个不相同的数。问有多少种序列满足这个条件。

2023-10-09 22:45:44 213

原创 ST表(RMQ问题)

跟建表一样确定 k = log2(r-l+1), 然后从ST[l][k]和ST[r-(1<<k)+1][k], 表示的区间分别是[l,l+(1<<k)-1]和区间[r-(1<<k)+1][r]两个大小为(1<<k)的子区间,虽然两个区间可能有重复的部分但是不影响最后结果。1.建表,首先明白ST[i][j],表示的是区间[i, i+(1<<j)-1]的最值,区间大小为2^j。首先初始化ST[i][0]=a[i]。因为ST[i][0]表示区间[i,i+(1<<0)-1],也就是[i,i],即a[i]本身。

2023-10-08 10:22:56 89

原创 E-Sort String

题目链接:https://ac.nowcoder.com/acm/problem/17244Eddy likes to play with string which is a sequence of characters. One day, Eddy has played with a stringSSfor a long time and wonders how could make it more enjoyable. Eddy comes up with following procedure..

2020-05-13 21:56:50 242

翻译 字符串hash

字符串hash: 就是把一个字符串通过函数 f 映射为一个整数。从而达到通过比较整数来确定字符串的出现次数。hash公式:const int maxn=1e6+100;typedef unsigned long long ull;ull Hash[maxn];ull f=33333;/*定义f为一个质数*/int main(){ char s[maxn]; for(int i=0;i<=maxn-1;i++) { Hash[i]=Hash[i

2020-05-13 20:51:18 151

原创 H - High Score(贪心)

You’ve just been playing a video game in which you had to move a worm through a maze using a joystick. You got the high score, and now you have to enter your name using this joystick. This works as fo...

2020-04-24 21:07:09 277

原创 数位dp(例题)

1.题目:不要62杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属...

2020-04-20 21:42:41 560

原创 F - Ramp Number G(数位dp)

题目链接:https://vj.z180.cn/4dae4df90b15954f63832fed332adb87?v=1587179126题意:T组数据,给你一个数,让你求出,小于这个数的所有ramp number,ramp number定义为从位数从高到低,保持数增加或不变,问有多少个小于n的数:思路:从最高位dfs,每次遇到满足ramp number的数的时候存下该状态,数位dp下去。...

2020-04-20 21:35:40 244

原创 F - Financial Planning (贪心+二分)

Being a responsible young adult, you have decided to start planning for retirement. Doing some back-of-the-envelope calculations, you figured out you need at leastMMeuros to retire comfortably.You...

2020-04-17 22:09:58 434

原创 G - Game Night (前缀和)

It is finally Bobby’s birthday, and all of his Acquaintances, Buddies and Colleagues have gathered for a board game night. They are going to play a board game which is played in up to three big teams....

2020-04-17 22:04:19 337

原创 给定四边形四条边长,求构成四边形面积最大是多少(数学)

#include<bits/stdc++.h>using namspace std;int main(){ double a,b,c,d; cin>>a>>b>>c>>d; double now=(a+b+c+d)/2.0; double ans=sqrt((now-a)*(now-b)*(now-...

2020-04-17 21:52:26 1071

原创 C. Linova and Kingdom(dfs+贪心)

C. Linova and Kingdomtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWriting light novels is the most important thing in Linova'...

2020-04-16 15:46:22 377

原创 树的直径(模板)

树的直径定义:我们将一棵树T = ( V,E )的直径定义为maxδ ( u,v )( u,v ∈ V ),也就是说,树中所有最短路径距离的最大值即为树的直径。2次dfs(取任意一点x,找到距x最远的点p,再找到距p的最远距离的点q,dist[p][q],为树的直径)模板:#include <bits/stdc++.h>using namespace std;co...

2020-04-10 19:47:23 299

转载 Circle Meets Square(几何)

正在上传…重新上传取消

2020-04-08 20:14:13 196

原创 First Last Sorting(思维,dp)

正在上传…重新上传取消

2020-04-08 19:59:19 143

原创 What day is that day? (打表)

It's Saturday today, what day is it after 11+ 22+ 33+ ... +NNdays?InputThere are multiple test cases. The first line of input contains an integerTindicating the number of test cases. For ea...

2020-04-08 19:45:15 429

原创 C - Sleep Buddies(状态压缩)

It is nighttime in the Earth Colony on Mars and everyone is getting ready to sleep. It is common to sleep in pairs, so that if anything were to happen during the night people could aid each other.To...

2020-03-04 19:55:37 261

原创 G - WiFi Password(后缀和)

Just days before the JCPC, your internet service went down. You decided to continue your training at the ACM club at your university. Sadly, you discovered that they have changed the WiFi password. On...

2020-03-04 19:43:42 363

原创 A - Arcade Game(概率)

Arcade mall is a new modern mall. It has a new hammer game called "Arcade Game". In this game you're presented with a numbernwhich is hanged on a wall on top of a long vertical tube, at the bottom o...

2020-03-04 19:36:34 250

原创 F - Icebergs(数学几何(三角形))

Tania is a marine biologist. Her goal is to measure the impact of climate change on the population of Macaroni penguins. As most species of penguins, Macaroni penguins live in the southern hemispher...

2020-02-21 20:34:29 1038

原创 Joseph and Tests(线段树+二分)

Joseph developed a device that allows people to decrease or increase their height by at mostDDunits. He's playing with his friend Lucas on a circuit with N houses, numbered from11toNN, on which L...

2020-02-21 20:27:40 284

原创 数学(F - Two Points )

There are two points(x1, y1)and(x2, y2)on the plane. They move with the velocities(vx1, vy1)and(vx2, vy2). Find the minimal distance between them ever in future.InputThe first line contains...

2020-02-21 20:16:55 430

原创 Going Home 网络流(最小费用最大流MCMF)

On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need t...

2020-02-21 20:15:17 247

原创 逆元(费马小定理)

Madam Hannah Otto, the CEO ofReviverCorp., is fond of palindromes, or words that read the same forwards or backwards. She thinks palindromic brand names are appealing to millennials.As part of the...

2020-02-13 17:02:43 259

原创 线段树(F - Finally, christmas! )

题目链接 https://codeforces.com/gym/102448/problem/FThe christmas spirit is taking over the city of Arcoverde! In honor of this special day, the mayor of this renowned metropolis decided to decorate a...

2020-02-12 16:59:36 204

原创 最短路(spfa)判断负环(dfs or bfs)

L - The Shortest PathYou are given a directed weighted graph withNnodes andMedges. Your task is to find the minimum shortest path between any pair of nodes in the graph. As the weight of the edg...

2020-02-10 12:10:47 301

原创 H - Hellcife is on fire(dijstra多源点)

The kingdom of Hellcife has several cities that are connected by some roads. One day, the king of Hellcife, Bair Jolsonaro, decided to set fire on some of these cities, just for fun. It's known that t...

2020-02-08 11:27:48 511

原创 最短路(dijstra)

邻接表+优先队列(无负边)求单源点的最短距离:有一个n个点,m条边的图,问s->t;的最短距离:代码:#include<bits/stdc++.h>#define ios() ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);using namespace std;typedef long long ll;...

2020-02-07 17:28:21 103

原创 线段树(B - Beza's Hangover )

模板题(区间查询,先修改(用map来存一下酒的毫升))Friday nights are tricky for UFPE's ICPC competitors - they must be careful with their plans, after all, they train on saturdays and must be in good shape to help their te...

2020-02-07 16:52:18 425

原创 网络流(dinic算法)

题目描述如题,给出一个网络图,以及其源点和汇点,求出其网络最大流。输入格式第一行包含四个正整数N、M、S、T,分别表示点的个数、有向边的个数、源点序号、汇点序号。接下来M行每行包含三个正整数ui、vi、wi,表示第i条有向边从ui出发,到达vi,边权为wi(即该边最大流量为wi)输出格式一行,包含一个正整数,即为该网络的最大流。输入输出样例输入 #14 5 4 34 ...

2020-02-06 17:32:41 229

原创 【逆元】(inv)

推荐博客:https://blog.csdn.net/baidu_35643793/article/details/752689111.费马小定理在是素数的情况下,对任意整数都有。如果无法被整除,则有可以在为素数的情况下求出一个数的逆元,即为逆元。题目中的数据范围1<=x<=10^9,p=1000000007,p是素数;所以x肯定就无法被p整除啊,所以最后就得出x的...

2020-02-06 16:43:48 187

原创 网络流(FF算法)

#include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=2e5;int n,m,s,t;int vis[maxn];struct node{ int to,w,nxt;}e[maxn];int head[maxn],cnt;void addedge(i...

2020-02-06 11:09:04 604

原创 邻接表

设一个结构体里面至少存放两个变量:当然结构体变量也应该是数组类型,数组大小取决于边的多少。其中有一个数组head[ ];和一个变量cnt,head【x】是记录以x为始点并且此时的head【x】的值为最后一条以x为始点的边的序号。cnt则是记录边的多少的。to,next;假设有一条边是a->b则存放的的时候为to指向的就是b;而next=head【a】,代表此时这条边是以a为始点的最有...

2020-02-04 17:05:44 135

原创 动态规划(H - Tickets)

Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He is wandering when could he go back home as early as...

2020-01-14 10:50:40 354

原创 寒假集训第二场(A - Abandoned Animal )

Your little sister has been a big help today: she went into town to do all the groceries! During this grand voyage, she was accompanied by her fluffy friend, Mr.Fluffynose the Stuffed Animal. Howe...

2020-01-14 08:55:57 341

转载 动态规划(免费馅饼)

都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝...

2020-01-13 21:36:49 153

原创 寒假集训第二次测试(E - Envious Exponents )

Alice and Bob have an integer NN. Alice and Bob are not happy with their integer. Last night they went to a cocktail party and found that another couple had the exact same integer! Because of that t...

2020-01-13 15:40:14 281

原创 2020寒假集训(H - Horror Film Night)

Emma and Marcos are two friends who love horror films. This year, and possibly the years hereafter, they want to watch as many films together as possible. Unfortunately, they do not exactly have ...

2020-01-13 09:32:48 379

原创 2020寒假集训第二场(D - Disastrous Doubling)

A scientist, E. Collie, is going to do some experiments with bacteria. Right now, she has one bacterium. She already knows that this species of bacteria doubles itself every hour. Hence, after one h...

2020-01-12 22:43:17 321

原创 CF补题 ---Codeforces Round #610 (Div. 2)B题(hard)

题意:给你n个商品价格,你有p钱,在这里有个k,问你用这些钱最多可以买多少个商品。可以进行两个操作:1、选择单买一个商品i,花费ai;2、可以连续买k个商品,花费k个商品中的最大商品价格。这两个操作都是在p大于你想进行的操作所需要的钱的前提下进行。思路:当然是进行第二个方案买的商品数量多。在前k个商品中判断前缀和与p的关系, #include <bits/st...

2019-12-26 21:57:08 185

原创 CF补题 ---Codeforces Round #610 (Div. 2)

题意:多组输入,在一维空间中给你一个范围a-b,给你一个站点这个站点有一个半径为r的覆盖范围,问:从a->b以每秒走1个单位长度的速度,其中在走完a,b时间内,其中有多少时间未在这个站点的覆盖范围内。思路:a->b的总时间是max(a,b)-min(a,b);仅需判断站点位于ab之间还是位于ab之外就行。 #include <bits/stdc++.h>...

2019-12-26 21:42:59 203

空空如也

空空如也

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

TA关注的人

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