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
													
											
												
												- 에라토스테네스의 체
 - koitp
 - 구현
 - PS
 - 백트래킹
 - 삼성 기출
 - Algorithm
 - 다이나믹 프로그래밍
 - BFS
 - 해커랭크
 - 그리디
 - dfs
 - sw expert academy
 - 알고리즘
 - 삼성 SDS 대학생 알고리즘 특강
 - hackerrank
 - DP
 - 백준
 - 스택
 - dynamic programming
 - 브루트포스
 - 동적 계획법
 - BOJ
 - 소수
 - 시뮬레이션
 - SWEA
 - 잠실
 - 완전탐색
 - C++
 - 맛집
 
													Archives
													
											
												
												- Today
 
- Total
 
펭로그
[C++] 백준 BOJ 13458 시험 감독 본문
문제링크 : https://noj.am/13458
단순 구현 문제인데 정답률이 25%대로 낮은 문제이다.
그 이유는 출력 자료형을 다들 고려하지 않아서 그런 것 같다.
최대로 나올 수 있는 값이 1,000,000 * 1,000,000이기 때문에 long long 타입을 사용해야한다.
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  | // BOJ 13458 시험 감독 #include <iostream> #include <vector> using namespace std; int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL); //    freopen("../input.txt", "r", stdin);     int num, main, sub;     cin >> num;     vector<int> person(num);     for (auto &i : person)         cin >> i;     cin >> main >> sub;     long long result = 0;     for (int idx = 0; idx < num; idx++) {         person[idx] -= main;         result++;         if (person[idx] <= 0)             continue;         if (person[idx] % sub > 0)             result++;         result += person[idx] / sub;     }     cout << result;     return 0; }  | cs | 
'Study > PS(Algorithm)' 카테고리의 다른 글
| [C++] Codeforces Round #514 (Div. 2) - C. Sequence Transformation (0) | 2018.10.06 | 
|---|---|
| [C++] Codeforces Round #514 (Div. 2) - A. Cashier (0) | 2018.10.06 | 
| [C++] 백준 BOJ 1991 트리 순회 (0) | 2018.10.03 | 
| [C++] 백준 BOJ 8916 이진 검색 트리 (0) | 2018.10.03 | 
| [C++] 백준 BOJ 11403 경로 찾기 (0) | 2018.10.02 | 
			  Comments