容斥君
文章平均质量分 79
StartDash
这个作者很懒,什么都没留下…
展开
-
HDU - 5072
HDU 5072There are n people standing in a line. Each of them has a unique id number. Now the Ragnarok is coming. We should choose 3 people to defend the evil. As a group, the 3 people sho原创 2017-04-14 16:07:58 · 318 阅读 · 0 评论 -
HDU 5514(哈?)
There are m stones lying on a circle, and n frogs are jumping over them. The stones are numbered from 0 to m−1 and the frogs are numbered from 1 to n. The i-th frog can j原创 2017-04-14 16:38:03 · 251 阅读 · 0 评论 -
Codeforces 547C - Mike and Foam (容斥)
在这个题用容斥做的过程中从别人的博客学到了一些有趣的处理方法(好吧,其实是我太菜了,那种方法我之前没见过)。。。。。。思路:先预处理出每个数的质因子然后对于每一个操作数算出与它互质的数的个数再加加减减。。。。。。详见代码,可能有说不清楚或者搞错的地方,望指正#include #include #include #include #include #include #includ原创 2017-05-01 13:55:41 · 213 阅读 · 0 评论 -
UVA 7040
大意:有一排一共n个珠子,要用m种颜色中的恰好k种去涂色,相邻的两个颜色要不同,问方案数。做法大概就是C(m,k)表示m中k种颜色,然后对于每k个颜色进行容斥(大概就是这样)代码:#include #include #include #include #include #include #include #include #include #include #inc原创 2017-05-16 12:32:16 · 280 阅读 · 0 评论 -
codeforces 296B - Yaroslav and Two Strings (DP+容斥)
B. Yaroslav and Two StringsYaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such原创 2017-07-04 21:35:33 · 300 阅读 · 0 评论 -
HDU 6169(数论+DP)
Problem DescriptionSenior Pan had just failed in his math exam, and he can only prepare to make up for it. So he began a daily task with Master Dong, Dong will give a simple math problem to poor原创 2017-09-07 09:36:18 · 355 阅读 · 0 评论