728x90
728x90
SMALL
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
풀이
멍청하게 float가 아닌 int로 푸는 바람에 시간이 오래걸렸다,, 디버그중 99 98 98 98 ... 이렇게 점수가 똑같아버리니 계속 틀리지,,,어휴 한심
입력 받은 후, 몇 번째로 큰 지 반복문을 통해 확인한 후에
"예를 들어, N 명의 학생이 있을 경우 N/10 명의 학생들에게 동일한 평점을 부여할 수 있다." 이 조건에 맞춰준다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
string str[10] = {"A+","A0","A-","B+","B0","B-","C+","C0","C-","D0" };
int main() {
int t_c = 0;
cin >> t_c;
for (int i = 0; i < t_c; i++) {
vector <float> v1;
int student_num, k;
cin >> student_num >> k;
for (int i = 0; i < student_num; i++) {
int a, b, c;
cin >> a >> b >> c;
v1.push_back(a * 0.35 + b * 0.45 + c * 0.2);
}
int cnt = 0;
for (int i = 0; i < student_num; i++) {
if (v1[i] > v1[k - 1]) cnt++;
}
cout << "#" << i + 1 << " " << str[cnt / (student_num / 10)] << endl;
}
return 0;
}
728x90
728x90
LIST
'Algorihtm > SWEA' 카테고리의 다른 글
C++ SWEA 1860. 진기의 최고급 붕어빵 (0) | 2023.11.08 |
---|---|
C++ SWEA 16800. 구구단 걷기 (0) | 2023.11.07 |
C++ SWEA 1859. 백만 장자 프로젝트 (0) | 2023.11.03 |
C++ SWEA 1225. [S/W 문제해결 기본] 7일차 - 암호생성기 (0) | 2023.11.03 |
C++ SWEA 2805. 농작물 수확하기 (1) | 2023.11.03 |