CodeForces 1096E: The Top Scorer】的更多相关文章

题目链接 感觉这题很裸啊,除了看着恶心点也没什么了,怎么过的人那么少.. \(Description\) 给定\(n,r,s\),表示有\(n\)个人,设每个人的得分是非负整数\(a_i\),已知第一个人的得分\(a_1\geq r\),所有人的得分之和\(\sum a_i=s\).得分最高的一个人获胜:若有多个人得分最高,则随机一个人获胜. 求在所有可能情况下,第一个人获胜的概率. \(n\leq100,\ 0\leq r\leq s\leq5000\). \(Solution\) 范围不是很…
一道经典组合数学+容斥题. 题目传送门:CF1096E. 题意简述: \(p\) 个人,每个人有得分 \(a_i\). 总得分 \(\sum a_i = s\). 第一个人得分 \(a_1 \ge r\). 得分最高的人可以获胜,如果多个人得分最高,则等概率随机其中一个人获胜. 问第一个人获胜的概率. 题解: 第一个人要获胜,他的得分必须是最高分. 考虑枚举第一个人的得分,假设 \(a_1 = x\). 再枚举总共有几个人得分和第一个人一样(包括第一个人),假设有 \(i\) 个. 那么剩下的…
题目地址:洛谷CF1096E 本场AC数最少 (最难) 的题目 题目大意:给出三个数p , s,r,表示有p人,每个人都有一个非负得分,所有人的得分和为s,Hasan的得分至少为r,求Hasan是第一的概率(得分相同的人名次是等概率分布) 数据范围: \(1 \leq p \leq 100,0 \leq r \leq s \leq 5000\) 注意输出有一个整数化处理:若 \(ans = \frac{P}{Q}\) ,输出 \(P \times inv_Q(mod\ 998244353)\)…
题目总链接:https://codeforces.com/contest/1096 A. Find Divisible 题意: 给出l,r,在[l,r]里面找两个数x,y,使得y%x==0,保证有解. 题解: 直接输出l,2*l就好啦,但我还是写了个循环... 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int T; ll l,r; int main(){ cin>>T; w…
传送门 Div 2的比赛,前四题还有那么多人过,应该是SB题,就不讲了. 这场比赛一堆计数题,很舒服.(虽然我没打) E. The Top Scorer 其实这题也不难,不知道为什么这么少人过. 考虑枚举那人的分数和有多少人和他同分,推一下就会发现我们只需要知道\(calc(sum,n,top)\)表示\(sum\)分,分给\(n\)个人,分数小于\(top\),的方案数. 好像不是很好直接搞,考虑容斥,枚举一下至少有几个人不满足条件即可. #include<bits/stdc++.h> na…
A.Find Divisible 沙比题 显然l和2*l可以直接满足条件. 代码 #include<iostream> #include<cctype> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<ctime> #include<cstdlib> #include<algorithm> #d…
这场出题人好像特别喜欢998244353,每个题里都放一个 A.Find Divisible 考察选手对输入输出的掌握 输出l 2*l即可(为啥你要放这个题,凑字数吗 #include<cstdio> int n,l,r; int main() { scanf("%d",&n); ;i<=n;i++) { scanf("%d%d",&l,&r); printf(*l); } ; } B.Substring Removal 一…
A 1-1 tie at home was sufficient for Guangzhou Evergrande to clinch the Asian Champions League title, the first Chinese club to win the tournament in more than two decades. clinch:拥吻,钉牢 tournament:锦标赛,联赛 on aggregate:总共,总计 It was difficult to spot a…
D. Top Secret Task time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output A top-secret military base under the command of Colonel Zuev is expecting an inspection from the Ministry of Defence. Acc…
D. Top Secret Task time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output A top-secret military base under the command of Colonel Zuev is expecting an inspection from the Ministry of Defence. Acc…
Case of a Top Secret 感觉除了两个点在那循环的部分, 其他时候绳子的长度每次变为一半一下, 就变成了Log(l)步.. 然后就暴力找就好啦, 循环的部分取个模. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, in…
Mike and Feet Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 548D Appoint description:  Description Mike is the president of country What-The-Fatherland. There are n bears living in thi…
题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi + 1 + bi + 2 - bi + 3.... 的操作,最后得到了a 序列,给定 a 序列,求原序列. 思路:水. #include <set> #include <map> #include <stack> #include <queue> #includ…
E - Qwerty78 Trip Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice Gym 100947E Description standard input/output Announcement   Statements Qwerty78 is a well known programmer (He is a member of the I…
题目: http://codeforces.com/problemset/problem/676/D code: #include <stdio.h> #define MAXN 1001 #define LEFT 0 #define TOP 1 #define RIGHT 2 #define BOTTOM 3 struct block{ //left,top,right,bottom ]; int doors_num; int rotats; int minutes; }; struct bl…
题目链接:http://codeforces.com/contest/727/problem/F 题目大意:有n个问题,每个问题有一个价值ai,一开始的心情值为q,每当读到一个问题时,心情值将会加上该问题的价值.问题只能按顺序读.有m个询问,求当q=bi时,至少要删去多少个问题才能使得在任何时候心情值都>=0 参考这篇:http://blog.csdn.net/aufeas/article/details/53031439 解法一: 贪心 分别求出最多删去i个问题需要的初始心情值的最小值f[i]…
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给出的01序列相等(比较时如果长度不等各自用0补齐) 题解: 1.我的做法是用Trie数来存储,先将所有数用0补齐成长度为18位,然后就是Trie的操作了. 2.官方题解中更好的做法是,直接将每个数的十进制表示中的奇数改成1,偶数改成0,比如12345,然后把它看成二进制数10101,还原成十进制是2…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them…
题目链接:http://codeforces.com/contest/95/problem/C 思路:首先dijkstra预处理出每个顶点到其他顶点的最短距离,然后如果该出租车到某个顶点的距离小于等于最短距离,就连边,费用为一开始出租车所需的费用,建好图之后再求一次最短路即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <…
题目链接:http://codeforces.com/problemset/problem/20/C 思路:需要用优化过的dijkstra,提供两种写法. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <queue> #include <set> #define…
题目链接:http://codeforces.com/problemset/problem/131/D 思路: 题目的意思是说给定一个无向图,求图中的顶点到环上顶点的最短距离(有且仅有一个环,并且环上顶点的距离不计). 一开始我是直接用Tarjan求的无向图的双连通分量,然后标记连通分量上的点(如果某一个连通分量上的顶点的个数大于1,那么就是环了,其余的都只有一个点),然后即使重新建图,spfa求最短路径. #include <iostream> #include <cstdio>…
D. Theseus and labyrinth 题目链接:http://codeforces.com/contest/676/problem/D Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of sizen × m and consists of blocks of size 1 × 1. Each block o…
B. Pyramid of Glasses 题目链接:http://codeforces.com/contest/676/problem/B Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to constr…
题目链接:codeforces 725D . Contest Balloons 先按气球数从大到小排序求出初始名次,并把名次排在第一队前面的队放入优先队列,按w-t-1值从小到大优先,然后依次给气球给排名在前面的的队,给完后自己的气球数减少,继续跟之前排在第一队后面的队比较,考虑是否加入队列,每次记录最好的名次. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> us…
题目链接:http://codeforces.com/problemset/problem/446/B #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e3+3; int matrix[N][N]; ll row[N],col[N]; ll dpr[N*N],dpc[N*N]; priority_queue <ll> q; int main() { ll n,m,k,p;…
最近一直在做 codeforces ,总觉得已经刷不动 BZOJ 了? ——真是弱喵 你看连 Div.2 的 B 题都要谢谢题解,不是闲就是傻 显然我没那么闲 ╮(╯_╰)╭ 我觉得这题的想法挺妙的~ 大意是你需要分别给 a 和 b cnt1 和 cnt2 个数字 但是 a 不要被 x 整除的数 ,as well as,b 不要被 y 整除的数 然后求需要给的最大数的最小值—— 最值的最值?那不是典型的二分吗? 但是——坑爹的英文题导致我完全没有意识到这一点…… 二分答案 v ,因为 a 不要被…
D - Chloe and pleasant prizes 链接 http://codeforces.com/contest/743/problem/D 题面 Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponso…
[codeforces 549]G. Happy Line 试题描述 Do 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 ice cream stall. We know that ea…
Gravity Flip Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, s…
Cosmic Tables Time Limit:3000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 222B Description The Free Meteor Association (FMA) has got a problem: as meteors are moving, the Universal Cosmic Descriptiv…