| //https://www.acmicpc.net/problem/4344 #include <iostream> | |
| #include <stack> | |
| using namespace std; | |
| int main() | |
| { | |
| int C; | |
| cin >> C; | |
| for(int i=0; i<C; i++) | |
| { | |
| int N; | |
| int sum=0; | |
| int avg; | |
| int cnt=0; | |
| stack<int> s; | |
| cin >> N; | |
| for(int j=0; j<N; j++) | |
| { | |
| int x; | |
| cin >> x; | |
| sum+=x; | |
| s.push(x); | |
| } | |
| avg=sum/N; | |
| for(int j=0; j<N; j++) | |
| { | |
| int x=s.top(); | |
| if(x>avg) cnt++; | |
| s.pop(); | |
| } | |
| float percent = ((float) cnt/ (float) N )*100; | |
| cout << fixed; | |
| cout.precision(3); | |
| cout << percent << "%" << endl; | |
| } | |
| } |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
| 171127_14891_톱니바퀴 (0) | 2017.11.27 |
|---|---|
| 171127_1476_날짜 계산 (0) | 2017.11.27 |
| 171127_2743_단어 길이 재기 (0) | 2017.11.27 |
| 171126_1032_명령 프롬프트 (0) | 2017.11.26 |
| 171126_10808_알파벳 개수 (0) | 2017.11.26 |