티스토리 뷰
import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int N = Integer.parseInt(br.readLine());
for (int i = 0; i < N; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
int students = Integer.parseInt(st.nextToken()); // 학생 수
double goodStudents = 0;
double sum = 0;
// 배열 저장
int[] points = new int[students];
for (int j = 0; j < students; j++) {
points[j] = Integer.parseInt(st.nextToken());
sum += points[j];
}
// avg
double avg = sum / students;
// goodStudents
for (int point : points) {
if (point > avg) {
goodStudents++;
}
}
String ans = String.format("%.3f", (goodStudents/students * 100));
bw.append(ans).append("%\n");
}
bw.flush();
bw.close();
}
}
- 막 깔끔하진 않은데 내가 생각했던대로 적어봤음
링크
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 모던자바스크립트
- js api
- 이펙티브자바 아이템59
- 패스트캠퍼스 컴퓨터공학 완주반
- 백준
- REST API
- 이펙티브자바 스터디
- 김영한 http
- js array
- 프로그래머스 SQL
- java
- 김영한 JPA
- dreamcoding
- 이펙티브자바 아이템60
- HTTP 완벽가이드
- HTTP 완벽 가이드
- BOJ
- 드림코딩
- js promise
- http
- JS 딥다이브
- 백기선 스터디
- ㅇㄷㅇㅈ
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- JPA 연관관계 매핑
- 프로그래머스
- 킹수빈닷컴
- 이펙티브자바
- GCP
- Spring Security
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함