Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 신설동역 맛집
- 10k 마라톤
- 서울 홍어삼합
- 서울 흑산도홍어
- 가민 인터벌 러닝
- github command
- MongoDB foreach
- Garmin Chronos
- 인터벌러닝
- 의정부 전주콩나물국밥
- 가민
- 신대방삼거리역 홍어
- 의정부시청역 콩나물국밥
- 마라톤
- 가민 크로노스
- 의정부 콩나물국밥 맛집
- java lombok
- 인터벌 러닝
- 가민 크로노스 인터벌 러닝
- 신대방삼거리역 흑산도홍어
- 의정부 전주본가
- 가민 크로노스 러닝
- MongoDB mongoimport
- lombok
- 10KM 러닝
- 의정부역 콩나물국밥
- Running 연습
- java 알고리즘
- 러너
- 알고리즘
Archives
- Today
- Total
나의 Winding Road
BAEKJOON 10825번: 국영수 본문
[2018-09-01 토요일]
* 내용: 국영수
1. 문제
2. 해결 방법
1. 문제
* 내용
- URL: https://www.acmicpc.net/problem/10825
2. 해결 방법
* 로직
- algorithm에 있는 sort 함수 활용
- 졍렬 로직 구현
※ cout, cin 시에 시간 초과가 발생하였다. printf, scanf로 변경
- 관련 참고 URL : https://www.acmicpc.net/board/view/15725
* 소스 코드
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 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <iostream> #include <algorithm> using namespace std; struct Student { char name[11]; int score1; int score2; int score3; }; Student stdnt[100001]; bool cmp1(const Student &a, const Student &b){ if (a.score1 == b.score1 && a.score2 != b.score2) { return a.score2 < b.score2; } else if (a.score1 == b.score1 && a.score2 == b.score2 && a.score3 != b.score3) { return a.score3 > b.score3; } else if (a.score1 == b.score1 && a.score2 == b.score2 && a.score3 == b.score3) { if(strcmp(a.name, b.name) < 0) return true; else return false; } return a.score1 > b.score1; } int main() { int N; scanf("%d", &N); for (int i = 0; i < N; i++) scanf("%s %d %d %d", stdnt[i].name, &stdnt[i].score1, &stdnt[i].score2, &stdnt[i].score3); sort(stdnt, stdnt + N, cmp1); for (int i = 0; i < N; i++){ printf("%s\n", stdnt[i].name); } return 0; } | cs |
'개발 > Algorithm' 카테고리의 다른 글
BAEKJOON 1152번: 단어의 개수 (0) | 2018.09.04 |
---|---|
BAEKJOON 9465번: 스티커 (0) | 2018.09.02 |
BAEKJOON 1463번: 1로 만들기 (0) | 2018.08.30 |
로봇 청소기 (0) | 2017.04.17 |
BAEKJOON 1260번: DFS와 BFS (1) | 2017.04.17 |
Comments