티스토리 뷰
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
- 김영한 JPA
- ㅇㄷㅇㅈ
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- 이펙티브자바
- 프로그래머스
- 프로그래머스 SQL
- dreamcoding
- js array
- JPA 연관관계 매핑
- 패스트캠퍼스 컴퓨터공학 완주반
- HTTP 완벽가이드
- 백기선 스터디
- JS 딥다이브
- js api
- 드림코딩
- 킹수빈닷컴
- 모던자바스크립트
- js promise
- Spring Security
- 이펙티브자바 아이템59
- java
- 김영한 http
- 이펙티브자바 아이템60
- 이펙티브자바 스터디
- REST API
- 백준
- GCP
- http
- HTTP 완벽 가이드
- BOJ
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함