-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_4344.java
More file actions
67 lines (57 loc) ยท 1.45 KB
/
_4344.java
File metadata and controls
67 lines (57 loc) ยท 1.45 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package backjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
// https://www.acmicpc.net/problem/4344
// ํ๊ท ์ ๋๊ฒ ์ง
public class _4344 {
public static void main(String[] args) throws IOException {
//sol memory 13288 time 116
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//ํ
์คํธ ์ผ์ด์ค ๊ฐ์
int cntCase = Integer.parseInt(br.readLine());
StringTokenizer st;
for(int i=0; i<cntCase; i++){
st = new StringTokenizer(br.readLine(), " ");
int cntStudent = Integer.parseInt(st.nextToken());
int[] score = new int[cntStudent];
int avg = 0;
double ratio = 0.0;
//๋ฐฐ์ด์ ์ฑ์ ๋ฃ๊ธฐ
for(int j=0; j<cntStudent; j++){
if(!st.hasMoreTokens()) break;
score[j] = Integer.parseInt(st.nextToken());
avg += score[j];
}
//ํ๊ท ๊ฐ(์์์ ๋ท์งธ์๋ฆฌ์์ ๋ฐ์ฌ๋ฆผ)
avg = avg/cntStudent;
//ํ๊ท ์ ๋๋ ํ์์ ๋น์จ
for(int k=0; k<cntStudent; k++){
if(score[k] > avg){
ratio++;
}
}
ratio = (ratio/cntStudent)*100.00;
System.out.printf("%.3f", ratio);
System.out.println("%");
}
}
}
/*
input
1
9 100 99 98 97 96 95 94 93 91
5
5 50 50 70 80 100
7 100 95 90 80 70 60 50
3 70 90 80
3 70 90 81
9 100 99 98 97 96 95 94 93 91
output
40.000%
57.143%
33.333%
66.667%
55.556%
*/