codeforces——200B——Drinks
来源:互联网 发布:大卫雕塑知乎 编辑:程序博客网 时间:2024/05/21 14:52
Little Vasya loves orange juice very much. That's why any food and drink in his kitchen necessarily contains orange juice. There aren drinks in his fridge, the volume fraction of orange juice in thei-th drink equals pi percent.
One day Vasya decided to make himself an orange cocktail. He took equal proportions of each of then drinks and mixed them. Then he wondered, how much orange juice the cocktail has.
Find the volume fraction of orange juice in the final drink.
The first input line contains a single integer n (1 ≤ n ≤ 100) — the number of orange-containing drinks in Vasya's fridge. The second line containsn integers pi (0 ≤ pi ≤ 100) — the volume fraction of orange juice in the i-th drink, in percent. The numbers are separated by a space.
Print the volume fraction in percent of orange juice in Vasya's cocktail. The answer will be considered correct if the absolute or relative error does not exceed10 - 4.
350 50 100
66.666666666667
40 25 50 75
37.500000000000
Note to the first sample: let's assume that Vasya takes x milliliters of each drink from the fridge. Then the volume of pure juice in the cocktail will equal milliliters. The total cocktail's volume equals3·x milliliters, so the volume fraction of the juice in the cocktail equals, that is,66.(6) percent.
输入n,m,然后输入n个数,分别不同橙汁是橙子比例,求混合后,橙子比例。
划水
#include <iostream>#include<cstring>#include<string>#include<stdio.h>#include<algorithm>#include<set>using namespace std;int main(){ int n; while(cin>>n!=NULL) { int sum=0,t=n; while(t--) { int t2; cin>>t2; sum+=t2; } printf("%.10lf\n",sum*100/(n*100.0)); } return 0;}
- codeforces——200B——Drinks
- CodeForces 200B Drinks
- CodeForces 200B Drinks
- Codeforces-200B-Drinks
- Codeforces Drinks
- B. Drinks
- codeforces——B. Spreadsheets
- Codeforces —— 359B Permutation
- CodeForces 154B——Colliders
- codeforces——B. Months and Years
- CodeForces 535B — Tavas and SaDDas
- 【codeforces】706B—Interesting drink
- Drinks
- codeforces #442 div2 Olya and Energy Drinks
- Codeforces 877 D Olya and Energy Drinks
- codeforces——339B——Xenia and Ringroad
- codeforces——492B——Vanya and Lanterns
- codeforces——808B——Average Sleep Time
- Tomcat中JVM内存溢出问题(centos)
- 利用jq生成二维码图片
- 学习java的部分
- Submit常用快捷键
- idea 基本命令
- codeforces——200B——Drinks
- 删除指定日期之前创建的文件(windows linux)
- IDEA配置Android SDK
- Caffe使用步骤
- LogManager分析
- jsoup抓取网页上的数据,Android同时获取数据
- 完美解决Spark应用日志级别设置
- hdu 1212
- Axure RP 8.0 Mac中文破解版链接