B - Average Gym - 101161B 组合数学】的更多相关文章

http://codeforces.com/gym/101161/attachments 今天被卡常了,其实是自己对组合数技巧研究的不够. 如果是n, m <= 1e5的,然后取模是质数,那么可以用费马小定理. 如果n, m都比较小,那么其实是直接杨辉三角.不用逆元那些. 这题的思路是,枚举每一一个ave,然后总和就是n * ave 相当于方程  x1 + x2 + .... + xn = n * ave中,在0 <= x[i] <= full的情况下,不同解的个数中,使得x[i] ==…
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.136 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.198 Average Precision (AP)…
大致题意: 给出一个点集,其中有一个点有相同的几率会被删除,求删除之后的点集够成的凸包上的点的平均数. 首先看到题目,可以考虑枚举删除的点,将其凸包上前后两点以及两点间凸包内所有点构建凸包,因为凸包内每个点 最多被访问一次,所以是O(N)的复杂度.理论上可行,但是实际上实现起来相当困难,又兴趣的可以去尝试. 这题的正解是先将所有的点求个凸包,若凸包顶点为偶数,则只需先删除凸包上的所有奇数点,然后求得一个凸包,然 后再删除凸包上偶数点,在求一次凸包,最后答案为 ans=两个凸包的顶点数+(m-1)…
原题链接:http://codeforces.com/gym/100338/attachments/download/2136/20062007-winter-petrozavodsk-camp-andrew-stankevich-contest-22-asc-22-en.pdf 题意 给你n个点,让你连边,使得每个点的度至少为1,问你方案数. 题解 从正面考虑非常困难,应从反面考虑,取 i 点出来不连,这样的取法一共有C(n,i)种取法,其他的连好,而这样就是子问题了.那么dp[n]=2^(n…
原题链接:http://codeforces.com/gym/100431/attachments/download/2421/20092010-winter-petrozavodsk-camp-andrew-stankevich-contest-37-asc-37-en.pdf 题意 给你一个n,问你有多少a和x满足:x在a中二分会返回true,其中a的长度是n 题解 考虑到二分的过程不是向左就是向右,所以可以暴力搜索搞到若干序列,这些序列都是由向左或者向右组成的.枚举x,设向左的有i个,向右…
题目链接:http://codeforces.com/gym/101147/problem/G G. The Galactic Olympics time limit per test 2.0 s memory limit per test 64 MB input galactic.in output standard output Altanie is a very large and strange country in Mars. People of Mars ages a lot. So…
一开始想着球盒模型,数据范围大,递推会GG. 用凑的方法来算方案.往n个小球之间插两个隔板,方案是(n-1)*(n-2)/2,不区分盒子,三个盒子小球数各不相同的方案数被算了6次(做排列), 两个相同的被算了3次,如果n可以被3整除,那么3个相同的被算了一次.全部都加到6,在一起除以6就得到总的方案数. 方案数对n的函数具有单调性,因此二分答案. #include<bits/stdc++.h> using namespace std; typedef long long ll; ll cal(…
CardsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86686#problem/K Description You have N cards with different numbers on them. Your goal is to find a card with a maximal number. At the beginning a…
Problem F. ColorDescriptionRecently, Mr. Big recieved n flowers from his fans. He wants to recolor those flowers withm colors. The flowers are put in a line. It is not allowed to color any adjacent flowers withthe same color. Flowers i and i + 1 are said…
2015 asia xian regional F Color (容斥 + 组合数学) 题目链接http://codeforces.com/gym/100548/attachments Description Recently, Mr. Bigrecieved n flowers from his fans. He wants to recolor those flowerswith m colors. The flowers are put in a line. It is not allow…