滴答滴答---题目链接 

A. Equalize Prices Again

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are both a shop keeper and a shop assistant at a small nearby shop. You have nn goods, the ii-th good costs aiai coins.

You got tired of remembering the price of each product when customers ask for it, thus you decided to simplify your life. More precisely you decided to set the same price for all nn goods you have.

However, you don't want to lose any money so you want to choose the price in such a way that the sum of new prices is not less than the sum of the initial prices. It means that if you sell all nn goods for the new price, you will receive at least the same (or greater) amount of money as if you sell them for their initial prices.

On the other hand, you don't want to lose customers because of big prices so among all prices you can choose you need to choose the minimum one.

So you need to find the minimum possible equal price of all nn goods so if you sell them for this price, you will receive at least the same (or greater) amount of money as if you sell them for their initial prices.

You have to answer qq independent queries.

Input

The first line of the input contains one integer qq (1≤q≤1001≤q≤100) — the number of queries. Then qq queries follow.

The first line of the query contains one integer nn (1≤n≤100)1≤n≤100) — the number of goods. The second line of the query contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤1071≤ai≤107), where aiai is the price of the ii-th good.

Output

For each query, print the answer for it — the minimum possible equal price of all nn goods so if you sell them for this price, you will receive at least the same (or greater) amount of money as if you sell them for their initial prices.

Example

input

Copy

3
5
1 2 3 4 5
3
1 2 2
4
1 1 1 1

output

Copy

3
2
1
#include <iostream>
#include<stdio.h>
using namespace std;int main()
{int t;scanf("%d",&t);while(t--){int n;scanf("%d",&n);int ans=0;for(int i=0; i<n; i++){int x;scanf("%d",&x);ans+=x;}if(ans%n==0)printf("%d\n",ans/n);else printf("%d\n",ans/n+1);}return 0;
}

A. Equalize Prices Again相关推荐

  1. Codeforces Round #570 (Div. 3)B. Equalize Prices

    原题出处:http://codeforces.com/contest/1183/problem/B There are nn products in the shop. The price of th ...

  2. Equalize Prices

    https://codeforces.com/contest/1183/problem/B 题意:求最大值B,使得所有|B-ai|<=k; 题解:数学+思维 a数组的所有值必须在[B-k,B+k ...

  3. Codeforcs 1183B Equalize Prices

    题目链接:codeforces.com/problemset/problem/1183/B 题意:给你 n 个数,每个数能在k范围内上下浮动,求能否使所有数相等,能输出相等的最大值,不能输出 -1. ...

  4. A. Equalize Prices Again(水题) Codeforces Round #590 (Div. 3)

    原题链接:https://codeforces.com/contest/1234/problem/A 派大星既是"比奇堡"一家小商店的店主又是售货员.店里有n种商品,第i种商品价格 ...

  5. 游戏ui切图,颜色通道_什么是ui通道设计,为什么如此重要

    游戏ui切图,颜色通道 Our approach to interface design has changed dramatically since the rise of mobile devic ...

  6. Codeforces Round #590 (Div. 3)

    Equalize Prices Again 有 n 件商品的价格,现在老板想让所有的商品的价格都一样,并且总价格尽量接近之前的价格,但要 >= 之前的价格 int main() {IOS;rus ...

  7. Codeforces Round #590 (Div. 3) 题解

    A  . Equalize Prices Again https://codeforces.com/contest/1234/problem/A 相加取平均,向上取整.. #include<bi ...

  8. 10.1 Codeforces Round #590 (Div.3)

    Codeforces Round #590 (Div. 3):点击进入新世界 总结: 第二次实时打cf,刚开始四分钟就且切了A题,后面看了B1 B2 难度改变对思路没有影响,一开始思路是对的,但是用h ...

  9. Kaggle: House Prices: Advanced Regression Techniques

    Kaggle: House Prices: Advanced Regression Techniques notebook来自https://www.kaggle.com/neviadomski/ho ...

最新文章

  1. jq--ajax中止请求
  2. 学精算的计算机知识,精算学专业学什么 附学习科目和课程
  3. 天池大赛 + CV语义分割 + 78万奖金:全国数字生态创新大赛来了!
  4. VLAN之间ACL和VACL的区别
  5. 计算机应用基础项目化教程实训评价手册答案,计算机应用基础实训指导
  6. 《犯罪心理学》读书笔记(part3)--影响犯罪心理形成发展的外部因素
  7. python中的LEGB 规则
  8. 【文末有赠书】从历史角度讲现代数学
  9. 校招生大规模涨薪、再扩招10000人?大厂抢人有多野?
  10. 谈谈如何学习R语言基础教程
  11. comsol圆柱形永磁体_comsol永磁体仿真
  12. WinRAR的注册破解
  13. SpringBoot整合MybatisPlus
  14. 闲话复数(2)——欧拉公式
  15. Linux连接荣耀路由器pro2,荣耀路由器Pro2与路由存储、远程访问、家庭共享
  16. linux的文件和文件夹操作
  17. 我学习网络管理员的第一步---各个时期的基本要求
  18. 一文梳理类脑计算的前世今生 | 中科院自动化所研究员李国齐
  19. PCA降维以及Kmeans聚类实例----python,sklearn,PCA,Kmeans
  20. Eloquent JavaScript 笔记 九: Regular Expressions(下)

热门文章

  1. Inspect的学习笔记
  2. python怎么做表格_零基础小白怎么用Python做表格?
  3. 波兰计算机专业大学排名,波兰留学大学排名
  4. 短视频平台还能这样赚钱?无需拍视频,每天能赚200多详细流程
  5. 短视频APP开发功能介绍
  6. Andriod界面设计的分辨率和尺寸适配全攻略 转载
  7. 30天自制操作系统——第四天使用C语言制作操作系统进度条
  8. 设计模式Java语言实现之策略模式
  9. 关于云计算的一些概念理解
  10. 百谷歌---学习工作好东西啊!!