티스토리 뷰
https://www.acmicpc.net/problem/4344
package study;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.nextLine();
String[] arr= new String[Integer.parseInt(a)];
for (int i=0;i<arr.length;i++)
{
arr[i]=sc.nextLine();
}
sc.close();
for (int i=0;i<arr.length;i++)
{
String[] innerarr = arr[i].split(" ");
int sum=0;
double average=0;
for (int j=1;j<innerarr.length;j++)
{
sum+=Integer.parseInt(innerarr[j]);
}
average = (double) sum / Integer.parseInt(innerarr[0]);
int count=0;
for (int j=1;j<innerarr.length;j++)
{
if ((double) Integer.parseInt(innerarr[j]) > average)
{
count++;
}
}
System.out.printf("%2.3f%%\n", (double) count / Integer.parseInt(innerarr[0])*100);
}
}
}
'알고리즘' 카테고리의 다른 글
1065 한수 (0) | 2017.03.17 |
---|---|
4673 셀프넘버 (0) | 2017.03.17 |
1110 더하기 사이클 (0) | 2017.03.16 |
10871 X보다 작은 수 (0) | 2017.03.16 |
11721 열 개씩 끊어 출력하기 (0) | 2017.03.16 |
- Total
- Today
- Yesterday
- 1046
- 센서
- 1143
- java
- 시험후기
- 1104
- 1048
- 1110
- 소인수분해
- 1103
- 반올림
- 1002
- 최소공배수
- CH340G
- 1124
- OS설치
- 챗봇
- 1111
- 1045
- Git
- 1044
- 1112
- 소수
- 팀을위한GIT
- 1050
- 근의공식
- 최대공약수
- ASCII
- acmicpc
- 등차수열
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |