ZOJ 2819 Average Score 牡丹江现场赛A题 水题/签到题
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, especially in Mathematical Analysis.
After a mid-term exam, Bob was anxious about his grade. He went to the professor asking about the result of the exam. The professor said:
"Too bad! You made me so disappointed."
"Hummm... I am giving lessons to two classes. If you were in the other class, the average scores of both classes will increase."
Now, you are given the scores of all students in the two classes, except for the Bob's. Please calculate the possible range of Bob's score. All scores shall be integers within [0, 100].
Input
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
The first line contains two integers N (2 <= N <= 50) and M (1 <= M <= 50) indicating the number of students in Bob's class and the number of students in the other class respectively.
The next line contains N - 1 integers A1, A2, .., AN-1 representing the scores of other students in Bob's class.
The last line contains M integers B1, B2, .., BM representing the scores of students in the other class.
Output
For each test case, output two integers representing the minimal possible score and the maximal possible score of Bob.
It is guaranteed that the solution always exists.
Sample Input
2
4 3
5 5 5
4 4 3
6 5
5 5 4 5 3
1 3 2 2 1
Sample Output
HINT
题意给你两个班级,告诉你把bob扔到B班去,两个班级的平均分都会上升,然后问你,bob的分数上下限是多少
题解:
暴力枚举平均分,然后显然bob只要比第一个班级的平均分低,比第二个班级的平均分高就行了
代码:
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
//const int inf=0x7fffffff; //无限大
const int inf=0x3f3f3f3f;
/* */
//**************************************************************************************
inline ll read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int main()
{
int t;
t=read();
while(t--)
{
int n,m;
n=read(),m=read();
int ans1=,ans2=;
for(int i=;i<n-;i++)
{
int x=read();
ans1+=x;
}
for(int i=;i<m;i++)
{
int x=read();
ans2+=x;
}
int t1=,t2=;
while(t1*m<=ans2)
t1++;
while(t2*(n-)<ans1)
t2++;
printf("%d %d\n",t1,t2-);
}
return ;
}
ZOJ 2819 Average Score 牡丹江现场赛A题 水题/签到题的更多相关文章
- 【解题报告】牡丹江现场赛之ABDIK ZOJ 3819 3820 3822 3827 3829
那天在机房做的同步赛,比现场赛要慢了一小时开始,直播那边已经可以看到榜了,所以上来就知道A和I是水题,当时机房电脑出了点问题,就慢了好几分钟,12分钟才A掉第一题... A.Average Score ...
- ZOJ 3827 Information Entropy(数学题 牡丹江现场赛)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do? problemId=5381 Information Theory is one of t ...
- ZOJ 3819 Average Score(数学 牡丹江游戏网站)
主题链接:problemId=5373">http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 Bob is ...
- 2014ACMICPC亚洲区域赛牡丹江现场赛之旅
下午就要坐卧铺赶回北京了.闲来无事.写个总结,给以后的自己看. 因为孔神要保研面试,所以仅仅有我们队里三个人上路. 我们是周五坐的十二点出发的卧铺,一路上不算无聊.恰巧邻床是北航的神犇.于是下午和北航 ...
- 2014ACM/ICPC亚洲区域赛牡丹江现场赛总结
不知道怎样说起-- 感觉还没那个比赛的感觉呢?如今就结束了. 9号.10号的时候学校还评比国奖.励志奖啥的,由于要来比赛,所以那些事情队友的国奖不能答辩.自己的励志奖班里乱搞要投票,自己又不在,真是无 ...
- zoj 3819 Average Score
Average Score Time Limit: 2 Seconds Memory Limit: 65536 KB Bob is a freshman in Marjar Universi ...
- ZOJ 3819 Average Score 水
水 Average Score Time Limit: 2 Seconds Memory Limit: 65536 KB Bob is a freshman in Marjar Univer ...
- [ACM] ZOJ 3819 Average Score (水题)
Average Score Time Limit: 2 Seconds Memory Limit: 65536 KB Bob is a freshman in Marjar Universi ...
- 2014 牡丹江现场赛 A.Average Score(zoj 3819) 解题报告
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 题目意思: 有两个class:A 和 B,Bob 在 Clas ...
随机推荐
- Linux 内核驱动--多点触摸接口【转】
转自:http://blog.csdn.net/joard_yang/article/details/6225937 译自:linux-2.6.31.14/Documentation/input/mu ...
- maven profile 优先级
maven profile是有优先级别 也就是说在setting.xml的profile优先级比pom中同名的profile高. 可以使用 mvn help:active-profiles 这个命令是 ...
- vue实现结算淘宝购物车效果
实现单选时的价格,全选时价格 单选效果图 全选效果图 html <template> <!-- 淘宝结算购物车 --> <div class="settleme ...
- rocketmq在linux上安装
1.下载bin压缩包,然后解压 官网下载地址:https://www.apache.org/dyn/closer.cgi?path=rocketmq/4.3.2/rocketmq-all-4.3.2- ...
- Error_code: 1594(mysql 5617)主从同步报错
报错信息 2017-09-05 09:37:22 7425 [ERROR] Slave SQL: Relay log read failure: Could not parse relay log e ...
- day6面向对象--继承、多态
继承 继承:就像遗传一样,继承就是拥有父类的所有方法和属性,并且能够定义自己独特的属性和方法,对上面的类进行扩展. 可以什么都不写,直接继承父类,如下: class People(object ...
- 【BZOJ】1152: [CTSC2006]歌唱王国Singleland
题解 读错题了,是最后留下一个牛人首长歌颂他,和其他人没有关系,t就相当于数据组数 结论题,具体可看 https://www.zhihu.com/question/59895916/answer/19 ...
- Spring Boot 教程demo
https://github.com/ityouknow/spring-boot-examples
- memory_get_usage()查看PHP脚本使用内存
memory_get_usage()可以查看当前php使用的内存大小.对于优化算法提高内存使用效率还是很实用的,尤其是对当下的移动端程序. <?php echo memory_get_usage ...
- JVM快速入门
最近开始了全面的JAVA生态环境学习,因此,JVM的学习是必不可少的一个环节.和.NET的CLR一样,一起的JAVA应用均跑在JVM虚拟机上,不过相对我们只能干看看的CLR,JVM有很大的灵活性,可以 ...