Skip to content

Instantly share code, notes, and snippets.

@Onjanirina
Created June 25, 2012 06:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Onjanirina/2986994 to your computer and use it in GitHub Desktop.
Save Onjanirina/2986994 to your computer and use it in GitHub Desktop.
Solution for 200B - Drinks on CodeForces (Round 126, Div2)
/**
* CodeForces - Round 126 (Div2) - Problem B - Drinks
* http://codeforces.com/contest/200/problem/B
*/
import java.io.*;
/**
* */
public class Solution {
/**
* @param args
*/
public static void main(String[] args){
try {
BufferedReader reader =new BufferedReader( new InputStreamReader( System.in)); // STDIN
Integer nDrinks=Integer.valueOf(reader.readLine().trim());
Integer[] percentages=new Integer[nDrinks];
Integer sum=0;
String[] str=reader.readLine().trim().split(" ",nDrinks);
for(int i=0;i!=str.length;i++){
percentages[i]=Integer.valueOf(str[i].trim());
sum+=percentages[i]; }
System.out.println((double)sum/percentages.length);
}catch(Exception e){
e.printStackTrace(System.err);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment