题意:给出A班和B班的学生成绩,如果bob(A班的)在B班的话,两个班级的平均分都会涨。求bob成绩可能的最大,最小值。

A班成绩平均值(不含BOB)>A班成绩平均值(含BOB) && B班成绩平均值(不含BOB)< B班成绩平均值(含BOB)

化简后得 B班成绩平均值(不含BOB) < X < A班成绩平均值(不含BOB)

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

4 4
2 4

 # include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <cmath>
# include <queue>
# define LL long long
using namespace std ; int main ()
{
//freopen("in.txt","r",stdin) ;
int T ;
scanf("%d" , &T) ;
while(T--)
{
int n , m ;
int t ;
int l , r ;
scanf("%d %d" , &n , &m) ;
int i ;
int sum1 = , sum2 = ;
for (i = ; i < n- ; i++)
{
scanf("%d" , &t) ;
sum1 += t ;
} for (i = ; i < m ; i++)
{
scanf("%d" , &t) ;
sum2 += t;
}
t = ;
while(t*m<=sum2)
t++ ;
l = t ;
while(t*(n-)<sum1)
t++ ;
r = t - ;
printf("%d %d\n" , l , r) ; } return ;
}

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

  1. zoj 3820(2014牡丹江现场赛B题)

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5374 思路:题目的意思是求树上的两点,使得树上其余的点到其中一个点的 ...

  2. zoj 3827(2014牡丹江现场赛 I题 )

    套公式 Sample Input 33 bit25 25 50 //百分数7 nat1 2 4 8 16 32 3710 dit10 10 10 10 10 10 10 10 10 10Sample ...

  3. 2014 牡丹江现场赛 i题 (zoj 3827 Information Entropy)

    I - Information Entropy Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %l ...

  4. ZOJ 3822 ( 2014牡丹江区域赛D题) (概率dp)

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5376 题意:每天往n*m的棋盘上放一颗棋子,求多少天能将棋盘的每行每列都至少有 ...

  5. 2014 牡丹江现场赛 A.Average Score(zoj 3819) 解题报告

    题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 题目意思: 有两个class:A 和 B,Bob 在 Clas ...

  6. ZOJ 2819 Average Score 牡丹江现场赛A题 水题/签到题

    ZOJ 2819 Average Score Time Limit: 2 Sec  Memory Limit: 60 MB 题目连接 http://acm.zju.edu.cn/onlinejudge ...

  7. 2014牡丹江 现场赛 F zoj 3824 Fiber-optic Network

    首先赞一下题目, 好题 题意: Marjar University has decided to upgrade the infrastructure of school intranet by us ...

  8. zoj 3809 枚举水题 (2014牡丹江网赛 A题)

    题目大意:给出一列取样的几个山的高度点,求山峰有几个? Sample Input 291 3 2 4 6 3 2 3 151 2 3 4 5Sample Output 30 # include < ...

  9. ACM学习历程——ZOJ 3822 Domination (2014牡丹江区域赛 D题)(概率,数学递推)

    Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often ...

随机推荐

  1. win10用vncviewer远程登陆ubuntu桌面

    一:安装Ubuntu的服务端桌面环境 # 安装xrdpsudo apt-get install xrdp # 安装xfce4sudo apt-get updatesudo apt-get instal ...

  2. Cat VS Dog HDU - 3829 (最大独立集 )

    Cat VS Dog Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)Total ...

  3. 如何整合Office Web Apps至自己开发的系统(二)

    WOPI项目的创建 首先用vs2012创建一个mvc4的程序.如图: 从上一篇我们可以知道,WOPI通讯主要通过两个服务: 一个是CheckFileInfo服务, 一个是GetFile服务. 所以下面 ...

  4. 解题:NOI 2010 超级钢琴

    题面 WC时候写的题,补一下 做法比较巧妙:记录每个位置和它当前对应区间的左右端点,做前缀和之后重载一下小于号,用优先队列+ST表维护当前最大值.这样贡献就是区间最大值和端点左边差分一下,可以O(1) ...

  5. 51 nod 1200 石子游戏V2 FWT

    放模板 #include<bits/stdc++.h> #define N 100005 using namespace std; const int p = 1000000007; in ...

  6. BZOJ 4720 [Noip2016]换教室

    4720: [Noip2016]换教室 Description 对于刚上大学的牛牛来说,他面临的第一个问题是如何根据实际情况申请合适的课程.在可以选择的课程中,有2n节课程安排在n个时间段上.在第i( ...

  7. 【CF61D】Eternal Victory

    题目大意:给定一棵 N 个节点的树,求从 1 号节点(根节点)出发,任意节点结束,且至少经过每个节点一次的最短路径是多少. 题解:首先考虑最终要回到根节点的情况,可以发现最短路径长度一定等于该树边权的 ...

  8. App爬虫神器mitmproxy和mitmdump的使用

    原文 mitmproxy是一个支持HTTP和HTTPS的抓包程序,有类似Fiddler.Charles的功能,只不过它是一个控制台的形式操作. mitmproxy还有两个关联组件.一个是mitmdum ...

  9. JavaScript中函数和类(以及this的使用<重点>,以及js和jquery讲解,原生js实现jquery)

    1.javascript中以函数来表示类: 一般函数是小写开头:function foo() 类开头是大写:function Foo() 实例化类: obj = new Foo() 其他属性就同类是一 ...

  10. ngx_lua_API 指令详解(四)ngx.exec指令

    https://github.com/openresty/lua-nginx-module#ngxexec 参照:http://blog.csdn.net/weiyuefei/article/deta ...