-
Angry Professor구현(Implementation) 2019. 4. 18. 13:43반응형
https://www.hackerrank.com/challenges/angry-professor/problem
Angry Professor | HackerRank
Decide whether or not the class will be canceled based on the arrival times of its students.
www.hackerrank.com
1. 문제
교수는 최소의 학생이 재시간에 도착하면 수업을 진행 하려고 한다. 문제의 k 는 교수가 원하는 제시간에 도착한 최소의 학생 수를 의미하며 n 개의 학생의 도착 시간이 주어진다.
2. 알고리즘
키워드 - 구현
3. 코드
1234567891011121314151617// Complete the angryProfessor function below.string angryProfessor(int k, vector<int> a) {const int size = a.size();int sol = 0;for(int i=0; i<size; i++) {if(0 >= a[i]) {sol++;}}//cout << sol << endl;if(sol >= k) {return "NO";} else {return "YES";}}반응형'구현(Implementation)' 카테고리의 다른 글
백준 2798번: 블랙젝 (0) 2020.11.28 백준 15969번: 행복 (0) 2020.11.28 백준 2511번: 카드놀이 (0) 2019.01.20 백준 13701번: 중복 제거 (0) 2019.01.14 백준 10984번: 내 학점을 구해줘 (0) 2019.01.14