- 博客(32)
- 收藏
- 关注
原创 牛客多校6 B. Eezie and Pie(树上差分+倍增)
思路:用倍增思想可以求出某个节点u上走a[u]步的节点编号,然后可以使用树上差分将这一段同时+1,最后跑一遍树上前缀和就能得出答案。题意:每个节点u都会将向1号节点的简单路径上、距离不超过a[u]中的节点+1,求每个节点上最后的值是多少。...
2022-08-16 09:37:49 177 1
原创 牛客多校6 J. Number Game
思路:不难发现b只有两种取值 b和a-b,对于c的操作,只有当b和a-b轮流作用于c时,才不会还原前一次操作,所以有两种情况:先b后a-b;打表不难发现这两种情况得出的c的绝对值是一个有规律的数列。题意: 有三个数 a,b,c,你可以将b变成a-b,将c变成b-c,且两种操作不限次数,求你是否能将c变成一个指定的数。...
2022-08-16 09:32:32 177
原创 牛客多校8 F. Longest Common Subsequence(打表+思维)
思路:分别计算出两段的元素值,将在第一段出现的元素打上标记,第二段如果得到打上标记的点,那么它后面的元素也会在第一段中出现,可以由此计算出答案。
2022-08-16 09:25:32 197
原创 牛客多校9 B. Two Frogs (概率dp+前缀和优化)
题意:有一个数轴,数轴上有许多点代表荷叶,两只青蛙在1上,要前往n上,两只青蛙每次能在( i,i+a[i] ]的范围内随机跳跃。求两只青蛙花相同步数跳到n号荷叶上的概率,用998244353取模。思路:设一只青蛙花i步跳到u号荷叶上的概率f[i][u],通过一只青蛙的概率,可以知道两只青蛙花相同步数跳到n号荷叶的概率res为。很明显这个转移方程会将一段数加上同一个值,故可以用前缀和优化。故可知状态转移方程为。...
2022-08-16 09:11:10 227
原创 2022hdu多校1C题题解
解释不取第i个物品f[i-1][j][k],取第i个物品f[i-1][j^v[i]][j-w[i]]状态转移f[i][j][k]=f[i-1][j^v[i]][k-w[i]]||f[i-1][j][k]题意有n个物品,体积为v,价值为w,背包容量为m,求恰好能使背包装满的最大物品价值异或和。状态f[i][j][k]表示前i个物品能否组成异或和为j,体积恰好为k。时间复杂度1024*1024*1024,必超时。优化用bitset状压,那么可以批量处理k维。...
2022-07-21 21:24:55 163
原创 2419:Coins(翻译)
http://noi.openjudge.cn/ch0402/2419/描述Snoopy has three coins. One day he tossed them on a table then and tried to flip some of them so that they had either all heads or all tails facing up. After several attempts, he found that regardless of the initia
2022-02-18 20:56:07 202
原创 Super Agent
https://acs.jxnu.edu.cn/problem/CF12A描述:There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they hav
2022-02-17 19:36:23 284
原创 Watermelon
描述:One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showedwkilos. They rushed home, dying of thirst, and deci...
2022-02-13 19:56:21 301
原创 Winner(翻译)
https://acs.jxnu.edu.cn/problem/CF2A描述:The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. T
2022-02-12 20:42:50 2763
原创 Crossing River(翻译)
http://noi.openjudge.cn/ch0406/702/描述A group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arrangement must be arranged in order to row the boat back and forth so that al
2022-02-11 21:54:40 195
原创 Plus One on the Subset
https://acs.jxnu.edu.cn/problem/CF1624A描述:Polycarp got an array of integersa[1…n]a[1…n]as a gift. Now he wants to perform a certain number of operations (possibly zero) so that all elements of the array become the same (that is, to becomea1=a2=⋯=ana...
2022-02-10 21:20:44 6088
原创 9290:Pku2680 Computer Transformation
http://noi.openjudge.cn/ch0206/9290/http://noi.openjudge.cn/ch0206/9290/描述A sequence consisting of one digit, the number 1 is initially written into a computer. At each successive time step, the computer simultaneously tranforms each digit 0 into the seq
2022-02-09 21:38:04 364
原创 2405:Avoid The Lakes(翻译)
http://noi.openjudge.cn/ch0308/2405/描述Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, however, an amount depending o
2022-02-08 21:22:06 346
原创 1625:Sequence Median(翻译)
http://noi.openjudge.cn/ch0401/1625/描述Given a sequence of N nonnegative integers. Let's define the median of such sequence. If N is odd the median is the element with stands in the middle of the sequence after it is sorted. One may notice that in this
2022-02-07 20:54:28 239 1
原创 917:Knight Moves(翻译)
描述BackgroundMr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him?S先生是一位出名的国际象棋选手,他断言没人能比他更快地将一个骑士移向另一位置,你能打败他吗?The ProblemYour task is to write a program t
2022-02-06 22:02:44 325
原创 最短路问题学习笔记
注意时间复杂度目录dijkstra算法(单源最短路,无负权边,有两种版本)Bellman_Ford算法(单源最短路,有负权边,可以处理不超过k条边问题)spfa算法(单源最短路,有负权变,比Bellman好)Floyd算法(多源最短路问题)dijkstra算法dijkstra算法分两种,一种是朴素版,另一种是堆优化版。朴素版适用于稠密图,时间复杂度与边数无关,堆优化版适用于稀疏图。朴素版dijkstra算法思路:朴素版的图用领接矩阵储存初始化:将dis..
2022-02-06 19:03:11 493
原创 1551:Sumsets
http://noi.openjudge.cn/ch0305/1551/描述Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S.给一个集合S,找到集合中不同元素a,b,c,d能满足a+b+c=d的最大d输入Several S, each consisting of a line containing
2022-02-05 22:01:33 363
原创 MEX (周练翻译)
描述:MihaihasjustlearnedabouttheMEXconceptandsincehelikeditsomuch,hedecidedtouseitrightaway.M学习了关于MEX的感念并且因为喜欢它,他决定立刻使用它Givenanarrayaofnnon-negativeintegers,Mihaiwantstocreateanewarraybthatisformedinthefollowing...
2022-01-29 21:22:50 6460
原创 Astronomy Problem
Flatland astronomy scientists are going to start permanent observations of n stars. The universe where the Flatland planet is located is two-dimensional, so each star is characterized by two coordinates (measured in parsecs). The scientists are looking for
2022-01-28 19:14:51 5219
原创 31:Candies
http://pdl.openjudge.cn/english/31/描述There are N bags. Each bag has some candies. You can take some of the bags. the total number of candies in these bags should be a multiple of K because you want to divide the candies equally between K friends. How m
2022-01-27 20:30:06 1151
原创 Professor John
https://acs.jxnu.edu.cn/problem/NOIOPJCH03083529描述:Professor John is investigating a math problem. He has obtained some relations among several variables. Now he would like to know if there are any other relations that can be deduced from these obtaine
2022-01-26 20:28:27 271
原创 Cake Baking
http://pdl.openjudge.cn/english/02/描述A banana cake takes 250 flour, 2 bananas, 75 sugar and 100 butter, and a chocolate cake takes 200 flour, 75 cocoa, 150 sugar and 150 butter. The profit of a chocolate cake is 45 and the profit of a banana cake is 40
2022-01-25 20:24:33 404
原创 Laser
https://acs.jxnu.edu.cn/problem/CF15B描述:Petya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field o
2022-01-23 21:51:39 329
原创 Burglar and Matches
https://acs.jxnu.edu.cn/contest/22/board/challenge/A描述:A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there aremcontainers, in thei-th container there areaimatchboxes, and each matchbox cont...
2022-01-22 20:36:49 234
原创 Map Coloring
https://acs.jxnu.edu.cn/problem/NOIOPJENGLISH01描述:Given edges of a graph with N nodes. There are three colors that can be used for coloring nodes. Determine the color of each node so that the colors of nodes of each edge should be different.(给一个有n个节点的地
2022-01-21 22:06:58 704
原创 7-15 汉诺塔的非递归实现
借助堆栈以非递归(循环)方式求解汉诺塔的问题(n, a, b, c),即将N个盘子从起始柱(标记为“a”)通过借助柱(标记为“b”)移动到目标柱(标记为“c”),并保证每个移动符合汉诺塔问题的要求。输入格式:输入为一个正整数N,即起始柱上的盘数。输出格式:每个操作(移动)占一行,按柱1 -> 柱2的格式输出。输入样例:3输出样例:a -> ca -> bc -> ba -> cb -> ab -> ca ->
2022-01-20 18:13:50 8074
原创 Bag of mice
https://acs.jxnu.edu.cn/problem/CF148D描述:The dragon and the princess are arguing about what to do on the New Year's Eve(龙和公主争论新年前夕做些什么). The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks th
2022-01-20 08:55:05 346
原创 Bargaining Table
https://acs.jxnu.edu.cn/problem/CF22B描述:Bob wants to put a new bargaining table in his office(Bob想在他的办公室里放一张新的谈判桌). To do so he measured the office room thoroughly and drew its plan: Bob's office room is a rectangular roomn × mmeters(为了做这个,Bob彻底测量了它的..
2022-01-19 09:14:31 179
原创 Deletion of Repeats
https://acs.jxnu.edu.cn/problem/CF19C描述:Once Bob saw a string(一天Bob看到了一串字符串). It contained so many different letters, that the letters were marked by numbers, but at the same time each letter could be met in the string at most 10 times(字符串里包含了许多不同的字母,这
2022-01-18 09:01:57 82
翻译 【无标题】Commentator problem
https://acs.jxnu.edu.cn/problem/CF2C描述:The Olympic Games in Bercouver are in full swing now.(在Bercouver的奥林匹克比赛正如火如荼的进行)Here everyone has their own objectives(在这每个人都有他们的目标): sportsmen compete for medals, and sport commentators compete for more convenie.
2022-01-17 09:10:21 91
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人