티스토리 뷰
백준 4344번
문제 사이트 :
https://www.acmicpc.net/problem/4344
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main(void) {
int Testcase;
scanf("%d", &Testcase);
for (int T = 0; T < Testcase; T++) {
int Student[1000] = { 0, };
int StudentNumber;
scanf("%d", &StudentNumber);
for (int S = 0; S < StudentNumber; S++) { //학생입력
scanf("%d", &Student[S]);
}
double Avg = 0;
for (int S = 0; S < StudentNumber; S++) { //총합 계산
Avg += Student[S];
}
Avg = Avg / StudentNumber; //평균 계산
int num = 0;
for (int S = 0; S < StudentNumber; S++) { //총합 계산
if (Avg < Student[S]) {
num++;
}
}
double percent = (num / (double)StudentNumber) * 100;
printf("%.3lf%\n", percent);
}
return 0;
}
'PS > 백준' 카테고리의 다른 글
| 1110번 더하기 사이클 (0) | 2019.06.22 |
|---|---|
| 1065번 한 수 (0) | 2019.06.22 |
| 15552번 빠른 A+B (0) | 2019.06.18 |
| 11721번 열 개씩 끊어 출력하기 (0) | 2019.06.18 |
| 11720번 숫자의 합 (0) | 2019.06.18 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 디자인패턴
- 오토레이아웃
- HumanInterfaceGuidelines
- Swift
- Firebase
- apple
- HIG
- Human Interface Guidelines
- storage
- MVC
- 싱글톤
- ios
- DP
- 온라인저지
- 분할정복
- 부스트코스
- UIView
- Human Interface Guideline
- 백준
- 알고리즘
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함
