-
Educational Codeforces Round 24 - A. Diplomas and Certificates코드포스(CodeForce) 2018. 8. 17. 17:42반응형
1. 문제
2. 알고리즘
키워드 - 구현
* 문제 접근
입력 받은 n 에 절반 이상에 학생이 학위를 받아야 한다. half
half 에서 학위를 받는 인원은 k 의 비율을 구한다.
z 는 w 2 배가 나와야 한다. 문제 제약 사항
몫은 전체 학생수 - z -w
3. 코드
123456789101112131415161718#include <iostream>#include <vector>#include <algorithm>#include <functional>#include <string>using namespace std;int main() {long long n, k;cin >> n >> k;long long half = n/2;long long w = half/(k+1);long long z = k*w;cout << w << " " << z << " " << n-z-w << endl;return 0;}cs 반응형'코드포스(CodeForce)' 카테고리의 다른 글
Codeforces Round #464 (Div. 2) - A - Love Triangle (0) 2018.08.17 Educational Codeforces Round 39 (Rated for Div. 2) - A. Partition (0) 2018.08.17 Codeforces Round #469 (Div. 2) - A. Left-handers, Right-handers and Ambidexters (0) 2018.08.17 Codeforces Round #460 (Div. 2) - A. Supermarket (0) 2018.08.17 Codeforces Round #460 (Div. 2) - B. Perfect Number (0) 2018.08.17