![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codeforces
文章平均质量分 83
wwt9b15bs
这个作者很懒,什么都没留下…
展开
-
【题解】codeforces118D Caesar's Legion 线性DP
题目链接 使用状态dp[i][j][k],i,j:步兵,骑兵个数 k:0是步兵,1是骑兵 状态方程:for(int k = 1; k <= min(i,k1); k++) dp[i][j][0] = (dp[i][j][0] + dp[i-k][j][1])%MOD; for(int k = 1; k <= min(j,...原创 2018-08-15 07:10:34 · 258 阅读 · 0 评论 -
【题解】codeforces549G[AHSOFNU codeforces训练赛1 by hzwer]B.Happy Line 排序
题目链接DescriptionDo you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue of n Berland residents lined up in front of the ...原创 2018-09-27 16:34:25 · 194 阅读 · 0 评论 -
【题解】codeforces528A[AHSOFNU codeforces训练赛1 by hzwer]C.Glass Carving set
题目链接DescriptionLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutt...原创 2018-09-27 17:12:35 · 232 阅读 · 0 评论 -
【题解】codeforces528B[AHSOFNU codeforces训练赛1 by hzwer]D.Clique Problem 排序
DescriptionThe clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a s...原创 2018-09-27 19:13:27 · 199 阅读 · 0 评论 -
【题解】codeforces1058G[Codeforces Round #512 Div.2]G.Linear Congruential Generator LCM+数学知识
DescriptionYou are given a tuple generator f(k)=(f1(k),f2(k),⋯ ,fn(k))f^{(k)}=(f^{(k)}_1,f^{(k)}_2,\cdots,f^{(k)}_n)f(k)=(f1(k),f2(k),⋯,fn(k)), where fi(k)=(ai⋅fi(k−1)+bi)mod&Thi...转载 2018-09-27 21:27:57 · 407 阅读 · 0 评论 -
【题解】codeforces1058A[Codeforces Round #512 Div.2]A.In Search of an Easy Problem 模拟
DescriptionWhen preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked n people abou...原创 2018-09-27 21:36:33 · 287 阅读 · 0 评论 -
【题解】codeforces24D Broken robot 期望DP+高斯消元+后效性处理
题目链接DescriptionYou received as a gift a very clever robot walking on a rectangular board. Unfortunately, you understood that it is broken and behaves rather strangely (randomly). The board consists ...原创 2018-09-28 20:24:59 · 360 阅读 · 0 评论 -
【题解】codeforces325B[AHSOFNU codeforces训练赛2 by hzwer]A.Stadium and Games 枚举+二分
题目链接DescriptionDaniel is organizing a football tournament. He has come up with the following tournament format:In the first several (possibly zero) stages, while the number of teams is even, they s...原创 2018-09-29 17:02:57 · 200 阅读 · 0 评论 -
【题解】codeforces235A[AHSOFNU codeforces训练赛2 by hzwer]B.LCM Challenge 数学知识
题目链接DescriptionSome days ago, I learned the concept of LCM (least common multiple). I’ve played with it for several times and I want to make a big number with it.But I also don’t want to use many n...转载 2018-09-29 17:26:33 · 207 阅读 · 0 评论 -
【题解】codeforces293A[AHSOFNU codeforces训练赛2 by hzwer]C.Weird Game 博弈论
题目链接DescriptionYaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn’t show up, Yaroslav and Andrey play another game.Roman leaves a word for...原创 2018-09-30 08:17:39 · 290 阅读 · 0 评论 -
【题解】codeforces293B[AHSOFNU codeforces训练赛2 by hzwer]D.Distinct Paths dfs+剪枝+位运算
题目链接DescriptionYou have a rectangular n × m-cell board. Some cells are already painted some of k colors. You need to paint each uncolored cell one of the k colors so that any path from the upper lef...转载 2018-09-30 10:10:46 · 150 阅读 · 0 评论 -
【题解】codeforces1047A[Codeforces Round #511 (Div. 2)]A.Little C Loves 3 I 数学知识
题目链接DescriptionLittle C loves number «3» very much. He loves all things about it.Now he has a positive integer n. He wants to split n into 3 positive integers a,b,c, such that a+b+c=n and none of t...原创 2018-09-30 13:44:43 · 190 阅读 · 0 评论 -
【题解】codeforces1047B[Codeforces Round #511 (Div. 2)]B.Cover Points 数学知识
题目链接DescriptionThere are nnn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(x_1,y_1),(x_2,y_2),…,(x_n,y_n)(x1,y1),(x2,y2),…,(xn,yn).You need to place an isosceles triangle with two sides on t...原创 2018-09-30 13:56:57 · 170 阅读 · 0 评论 -
【题解】codeforces1047C[Codeforces Round #511 (Div. 2)]C.Enlarge GCD 最大公约数
DescriptionMr. F has n positive integers, a1,a2,…,an.He thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.But this proble...原创 2018-09-30 15:01:56 · 234 阅读 · 0 评论 -
【题解】codeforces1047D[Codeforces Round #511 (Div. 2)]D.Little C Loves 3 II 数学知识
题目链接DescriptionLittle C loves number «3» very much. He loves all things about it.Now he is playing a game on a chessboard of size n×m. The cell in the x-th row and in the y-th column is called (x,y...原创 2018-09-30 15:42:13 · 341 阅读 · 0 评论 -
【题解】codeforces549C[AHSOFNU codeforces训练赛1 by hzwer]A.The Game Of Parity 博弈论
DescriptionThere are n cities in Westeros. The i-th city is inhabited by ai people. Daenerys and Stannis play the following game: in one single move, a player chooses a certain town and burns it to t...原创 2018-09-27 15:49:39 · 172 阅读 · 0 评论 -
【题解】codeforces1058F[ Codeforces Round #512 Div.2]F.Putting Boxes Together 树状数组+二分
题目链接DescriptionThere is an infinite line consisting of cells. There are n boxes in some cells of this line. The ithi_{th}ith box stands in the cell aia_iai and has weight wiw_iwi. All aia_iai ar...转载 2018-09-27 12:01:14 · 314 阅读 · 0 评论 -
【题解】codeforces1058E[Codeforces Round #512 Div.2 E]E.Vasya and Good Sequences 位运算
DescriptionVasya has a sequence a consisting of nnn integers a1,a2,⋯ ,ana_1,a_2,\cdots,a_na1,a2,⋯,an. Vasya may pefrom the following operation: choose some number from the sequence a...原创 2018-09-27 09:41:26 · 319 阅读 · 0 评论 -
【题解】codeforces-670C.Cinema 排序+离散化+map
题目链接 把所有电影和人涉及的语言放进一个数组,排序并离散化,用一个1~2*m+n之间的整数代替每种语言#include<cstdio>#include<map>#include<algorithm>using namespace std;#define _rep(i,a,b) for(int i=(a);i<=(b);i++)cons原创 2018-08-26 22:36:17 · 229 阅读 · 0 评论 -
【题解】codeforces1029A[Codeforces Round #506 (Div. 3)]A.Many Equal Substrings KMP
题目链接DescriptionYou are given a string ttt consisting of nnn lowercase Latin letters and an integer number kkk.Let’s define a substring of some string sss with indices from lll to rrr as s[l…r]s[l…r...原创 2018-09-24 14:45:27 · 228 阅读 · 0 评论 -
【题解】codeforces1029B[Codeforces Round #506 (Div. 3)]B.Creating the Contest 贪心
题目链接DescriptionYou are given a problemset consisting of nnn problems. The difficulty of the iii-th problem is aia_iai. It is guaranteed that all difficulties are distinct and are given in the incre...原创 2018-09-24 14:57:50 · 275 阅读 · 0 评论 -
【题解】codeforces1029C[Codeforces Round #506 (Div. 3)]C.Maximal Intersection multiset
题目链接DescriptionYou are given nnn segments on a number line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be...原创 2018-09-24 17:24:02 · 225 阅读 · 0 评论 -
【题解】codeforces1029D[Codeforces Round #506 (Div. 3)]D.Concatenated Multiples 排序
DescriptionYou are given an array aaa, consisting of nnn positive integers.Let’s call a concatenation of numbers xxx and yyy the number that is obtained by writing down numbers xxx and yyy one right...原创 2018-09-24 18:53:40 · 214 阅读 · 0 评论 -
【题解】codeforces1029E[Codeforces Round #506 (Div. 3)]E.Tree with Small Distances 优先队列+dfs
题目链接DescriptionYou are given an undirected tree consisting of nnn vertices. An undirected tree is a connected undirected graph with n−1n−1n−1 edges.Your task is to add the minimum number of edges i...原创 2018-09-24 20:57:40 · 345 阅读 · 0 评论 -
【题解】codeforces1029F[Codeforces Round #506 (Div. 3)]F.Multicolored Markers set
题目链接DescriptionThere is an infinite board of square tiles. Initially all tiles are white.Vova has a red marker and a blue marker. Red marker can color aaa tiles. Blue marker can color bbb tiles. If...原创 2018-09-24 21:45:20 · 252 阅读 · 0 评论 -
【题解】codeforces776B(LibreOJ10200)Sherlock and his girlfriend 线性筛
题目链接DescriptionSherlock has a new girlfriend (so unlike him!). Valentine’s day is coming and he wants to gift her some jewelry.He bought n pieces of jewelry. The i-th piece has price equal to i + 1...原创 2018-09-19 17:23:58 · 280 阅读 · 0 评论 -
【题解】codeforces451E Devu and Flowers 容斥原理+组合计数
DescriptionDevu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hence they are indis...原创 2018-09-13 06:52:50 · 345 阅读 · 0 评论 -
【题解】codeforces664A Complicated GCD 最大公约数
题目链接DescriptionGreatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algor...原创 2018-09-20 09:43:05 · 286 阅读 · 0 评论 -
【题解】codeforces1058B[Codeforces Round #512 Div.2 B]B.Vasya and Cornfield 数学知识
DescriptionVasya owns a cornfield which can be defined with two integers n and d. The cornfield can be represented as rectangle with vertices having Cartesian coordinates (0,d),(d,0),(n,n−d) and (n−d...原创 2018-09-26 20:52:36 · 260 阅读 · 0 评论 -
【题解】codeforces1058C[Codeforces Round #512 Div.2 C]C.Vasya and Golden Ticket 区间DP
DescriptionRecently Vasya found a golden ticket — a sequence which consists of nnn digits a1a2⋯an‾\overline{a_1a_2\cdots a_n}a1a2⋯an. Vasya considers a ticket to be lucky if it can be divided int...原创 2018-09-26 22:27:10 · 266 阅读 · 2 评论 -
【题解】codeforces1058D[Codeforces Round #512 D]D.Vasya and Triangle 最大公约数
题目链接DescriptionVasya has got three integers nnn, mmm and kkk. He’d like to find three integer points (x1,y1)(x_1,y_1)(x1,y1), (x2,y2)(x_2,y_2)(x2,y2), (x3,y3)(x_3,y_3)(x3,y3), such that 0≤x1,x...原创 2018-09-26 23:15:39 · 350 阅读 · 0 评论 -
【题解】codeforces987BHigh School: Become Human 数学知识
取对数乘出来比较(同学的一道考试题……这题1分钟就没了吧)#include<cstdio>#include<iostream>#include<cmath>using namespace std;const double eps=1e-6;long double a,b,x,y;int main(){ cin>>x>>...原创 2018-10-28 22:07:06 · 152 阅读 · 0 评论