306666: CF1234A. Equalize Prices Again
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Equalize Prices Again
题意翻译
## 题目大意 有n个商品,其中第i个商品的成本为a_i。 现在要求你求出一个平均价格,使得每件商品按照此平均价格卖出后不亏本,而且赚到的钱最少(挣的钱可以为0) 注意题目有多组数据。 ### 输入格式 第一行输入数据组数q(1≤q≤100,q为整数)。 接下来q组数据。对于每组数据,先输入商品个数n(1≤n≤100,n为整数),接下来一行包含n个整数:a_1,a_2,... ... ,a_n,其中a_i表示第i个商品的成本。 ### 输出格式 对于每组数据,每行输出一个平均价格。 Translated by @夙_愿扬题目描述
You are both a shop keeper and a shop assistant at a small nearby shop. You have $ n $ goods, the $ i $ -th good costs $ a_i $ 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 $ n $ 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 $ n $ 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 $ n $ 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 $ q $ independent queries.输入输出格式
输入格式
The first line of the input contains one integer $ q $ ( $ 1 \le q \le 100 $ ) — the number of queries. Then $ q $ queries follow. The first line of the query contains one integer $ n $ ( $ 1 \le n \le 100) $ — the number of goods. The second line of the query contains $ n $ integers $ a_1, a_2, \dots, a_n $ ( $ 1 \le a_i \le 10^7 $ ), where $ a_i $ is the price of the $ i $ -th good.
输出格式
For each query, print the answer for it — the minimum possible equal price of all $ n $ 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.
输入输出样例
输入样例 #1
3
5
1 2 3 4 5
3
1 2 2
4
1 1 1 1
输出样例 #1
3
2
1