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 | 31 |
Tags
- coding
- 문제풀이
- Computer science
- 코딩
- c++
- 컴퓨터공학과
- Operating System
- OS
- 정석
- 너비우선탐색
- 그래프
- 정석학술정보관
- 알고리즘
- 개발
- Stack
- vector
- 스택
- 북리뷰
- bfs
- 코테
- 백준
- 컴공과
- 오에스
- cs
- DP
- 구현
- 브루트포스
- 자료구조
- 오퍼레이팅시스템
- 컴공
Archives
- Today
- Total
Little Jay
[C++] 백준 1267번 핸드폰 요금 본문
#include <iostream>
using namespace std;
int young(int arr[], int& calls) {
int result = 0;
for (int i = 0; i < calls; i++) {
int temp = (arr[i] / 30) + 1;
result += temp;
}
return result * 10;
}
int min(int arr[], int& calls) {
int result = 0;
for (int i = 0; i < calls; i++) {
int temp = (arr[i] / 60) + 1;
result += temp;
}
return result * 15;
}
int main() {
int calls;
cin >> calls;
int a[10000];
for (int i = 0; i < calls; i++) {
cin >> a[i];
}
int y = young(a, calls);
int m = min(a, calls);
if (y == m) {
cout << "Y M " << m << "\n";
}
else if (y > m) {
cout << "M " << m << "\n";
}
else {
cout << "Y " << y << "\n";
}
return 0;
}'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 2953번 나는 요리사다 (0) | 2021.03.01 |
|---|---|
| [C++] 백준 2908번 상수 (0) | 2021.03.01 |
| [C++] 백준 2747번 피보나치 수 (0) | 2021.02.28 |
| [C++] 백준 2693번 N번째 큰 수 (0) | 2021.02.28 |
| [C++] 백준 3507번 Automated Telephone Exchange (0) | 2021.02.27 |
Comments