zoj 3819(2014牡丹江现场赛 A题 )】的更多相关文章

题意:给出A班和B班的学生成绩,如果bob(A班的)在B班的话,两个班级的平均分都会涨.求bob成绩可能的最大,最小值. A班成绩平均值(不含BOB)>A班成绩平均值(含BOB) && B班成绩平均值(不含BOB)< B班成绩平均值(含BOB) 化简后得 B班成绩平均值(不含BOB) < X < A班成绩平均值(不含BOB) Sample Input 24 35 5 54 4 36 55 5 4 5 31 3 2 2 1Sample Output 4 42 4 #…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5374 思路:题目的意思是求树上的两点,使得树上其余的点到其中一个点的最长距离最小.可以想到这题与树直径有关,我们可以这样做,首先求出树的直径,然后取出树的中点以及与该中点相邻,并且是直径上的一个点,这样就把这棵树划分为两颗子树,然后分别求出这两棵树的直径,最后要选择的两个点分别就是这两棵树的直径上的中点. 一开始是用dfs写的,结果爆栈了,改成bfs就过了. #in…
套公式 Sample Input 33 bit25 25 50 //百分数7 nat1 2 4 8 16 32 3710 dit10 10 10 10 10 10 10 10 10 10Sample Output 1.5000000000001.4808108324651.000000000000 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm>…
I - Information Entropy Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Description Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter abo…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5376 题意:每天往n*m的棋盘上放一颗棋子,求多少天能将棋盘的每行每列都至少有一颗棋子的期望 分析: 我们来分析一波: 讲解一下弱弱的我的解题思路 (1)首先可以想到的是设一个 dp[val]  表示 当前用了val 个旗子距离目标状态还有几天的概率.但是我们可以发现单纯的一个状态val 是不能表示出准确的状态 , 比如说现在只是知道了我使用了多少的旗子,当前不知道有多少行和…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 题目意思: 有两个class:A 和 B,Bob 在 Class A 里面.现在给出 Class A(n-1人) 和 Class B(m人) 所有人的分数,除了Bob,所以Class A 少了一个人.现在需要找出 Bob 最大可能的分数和最少可能的分数,使得他在Class A 里面拉低平均分,而在Class B 里面提高平均分. 由于数据量不大,所以可以暴力枚…
ZOJ 2819 Average Score Time Limit: 2 Sec  Memory Limit: 60 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 Description Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especia…
首先赞一下题目, 好题 题意: Marjar University has decided to upgrade the infrastructure of school intranet by using fiber-optic technology. There are N buildings in the school. Each building will be installed with one router. These routers are connected by optic…
题目大意:给出一列取样的几个山的高度点,求山峰有几个? Sample Input 291 3 2 4 6 3 2 3 151 2 3 4 5Sample Output 30 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmath> # define LL long long using namespace…
Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his friends. What's more, he bought a large decorative chessboard with N rows and M columns. Every day after work, Edward will place…
Description Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since every operator in an expression follows all of its operands. Bob is a student in…
3799567 2014-10-14 10:13:59                                                                     Accepted                                                             3822 C++ 1870 71760 njczy2010 3799566 2014-10-14 10:13:25                            …
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5071 思路:模拟题,没啥可说的,移动的时候需要注意top的变化. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAX_N = (5000 + 500); struct Girl { int…
地址 题意:求在m种颜色中挑选k种颜色,给n个花朵涂色有几种方法. 分析:画图可以发现,基本的公式就是k ×(k-1)^(n-1).但这仅保证了相邻颜色不同,总颜色数不超过k种,并没有保证恰好出现k种颜色:接着就是一个容斥问题,上述计算方法中包含了只含有2.3.….(k-1)种颜色的情况,需要通过容斥原理去除.假设出现p (2 <= p <= k-1)种颜色,从k种颜色中选取p种进行涂色,方案数为C(k,p) × p × (p-1)^(n-1) :总的方案数就是C(m,k) × ( k × (…
Hexadecimal View Time Limit: 2 Seconds       Memory Limit: 65536 KB Hexadecimal is very important and useful for computer programmers. You are requested to provide a hexadecimal view for given data. The hexadecimal view is made up of one or more rows…
Coprime Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 130    Accepted Submission(s): 59 Problem Description There are n people standing in a line. Each of them has a unique id number. Now t…
http://acm.hdu.edu.cn/showproblem.php?pid=5078 现场最水的一道题 连排序都不用,由于说了ti<ti+1 //#pragma comment(linker, "/STACK:102400000,102400000") #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include &l…
数据 表示每次到达某个位置的坐标和时间 计算出每对相邻点之间转移的速度(两点间距离距离/相隔时间) 输出最大值 Sample Input252 1 9//t x y3 7 25 9 06 6 37 6 01011 35 6723 2 2929 58 2230 67 6936 56 9362 42 1167 73 2968 19 2172 37 8482 24 98 Sample Output9.219544457354.5893762558 # include <iostream> # inc…
n个格子排成一行,有m种颜色,问用恰好k种颜色进行染色,使得相邻格子颜色不同的方案数. integers n, m, k (1 ≤n, m ≤ 10^9, 1 ≤ k ≤ 10^6, k ≤ n, m). m种颜色取k种 C(m, k) 这个可以放最后乘 那么问题就变成只用k种颜色第一个格子有k种涂法 第二个有k-1种 第三个也是k-1种 一共就是k*(k-1)^(n-1) 这种算法仅保证了相邻颜色不同,总颜色数不超过k种,并没有保证恰好出现k种颜色 也就是多算了恰好出现2种 恰好出现3种...…
两个圆环的内外径相同 给出内外径 和 两个圆心 求两个圆环相交的面积 画下图可以知道 就是两个大圆交-2*小圆与大圆交+2小圆交 Sample Input22 30 00 02 30 05 0 Sample OutputCase #1: 15.707963Case #2: 2.250778 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # i…
把一个序列按从小到大排序 要执行多少次操作 只需要从右往左统计,并且不断更新最小值,若当前数为最小值,则将最小值更新为当前数,否则sum+1 Sample Input255 4 3 2 155 1 2 3 4 Sample OutputCase #1: 4Case #2: 1 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include…
给出某个时刻对应的速度 求出相邻时刻的平均速度 输出最大值 Sample Input23 // n2 2 //t v1 13 430 31 52 0 Sample OutputCase #1: 2.00Case #2: 5.00 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <string> # include…
题意:从2~n-1这几个点中任意去掉一个点,使得从1到n的最短路径最大,如果任意去掉一个点1~n无通路输出Inf. Sample Input4 51 2 31 3 71 4 502 3 43 4 23 21 2 302 3 100 0 Sample Output50Inf # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include &l…
题意:对给出的好汉按杀敌数从大到小排序,若相等,按字典序排.M个询问,询问名字输出对应的主排名和次排名.(排序之后)主排名是在该名字前比他杀敌数多的人的个数加1,次排名是该名字前和他杀敌数相等的人的个数加1,(也就是杀敌数相等,但是字典序比他小的人数加1) Sample Input5WuSong 12LuZhishen 12SongJiang 13LuJunyi 1HuaRong 155 //mWuSongLuJunyiLuZhishenHuaRongSongJiang0 Sample Outp…
杭州现场赛的题.BFS+DFS #include <iostream> #include<cstdio> #include<cstring> #define inf 9999999 using namespace std; char mp[105][105]; int sq[5][5]; int step[4][2]={{0,1},{1,0},{0,-1},{-1,0}}; struct pos { int x,y; }; int n,m,prn,x,y,tmp,ans…
2018ACM-ICPC南京现场赛D题-Country Meow Problem D. Country Meow Input file: standard input Output file: standard output In the 24th century, there is a country somewhere in the universe, namely Country Meow. Due to advanced technology, people can easily tra…
那天在机房做的同步赛,比现场赛要慢了一小时开始,直播那边已经可以看到榜了,所以上来就知道A和I是水题,当时机房电脑出了点问题,就慢了好几分钟,12分钟才A掉第一题... A.Average Score 题目大意:给定A序列和B序列,长度分别是n和m,告诉你A序列中的n-1个数和B序列的m个数,求剩下的那个A序列中的数满足:将这个数从A序列移除,然后添加到B序列,使得A序列的平均值变小,B序列的平均值变大.求这个数的取值范围(是整数) 解题思路:求出A序列剩下的n-1个数的平均值,和B序列的平均值…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do? problemId=5381 Information Theory is one of the most popular courses in Marjar University. In this course, there is an important chapter about information entropy. Entropy is the average amount o…
第一年参加现场赛,比赛的时候就A了这一道,基本全场都A的签到题竟然A不出来,结果题目重现的时候1A,好受打击 ORZ..... 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4800 题目大意:给定C(3,N)支队伍之间对战的获胜概率,再给定一个序列存放队伍编号,每次获胜之后可以选择和当前战胜的对手换队伍.问按给定序列依次挑战全部胜利的最大概率. 解题思路:状压DP dp[i][j]表示使用队伍i从编号j开始挑战全胜的概率,ai[i]表示i位置的队…
下午就要坐卧铺赶回北京了.闲来无事.写个总结,给以后的自己看. 因为孔神要保研面试,所以仅仅有我们队里三个人上路. 我们是周五坐的十二点出发的卧铺,一路上不算无聊.恰巧邻床是北航的神犇.于是下午和北航神犇玩了一段时间的杀人游戏,晚上还旁观昂神与众神谈论职场形式,未来出路,认为听着有豁然开朗的感觉(听说网上卖菜比搞IT赚的很多其它,也是醉了).无限YM中...只是尽管是卧铺,想入睡也不是那么easy.睡睡醒醒,也挺折腾 第二天七点多到的牡丹江.感觉尽管都是东北,只是这个小城显然不如我家沈阳繁华,尤…