Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 아두이노 소스
- stl
- 아두이노 컴파일러
- 시스템프로그래밍
- Stack
- vector
- c++
- 수광 소자
- arduino compiler
- Array
- html
- Arduino
- list
- 통계학
- priority_queue
- 라인트레이서
- C언어
- Deque
- LineTracer
- 컴퓨터 그래픽스
- 자료구조
- map
- WinAPI
- queue
- Algorithm
- 아두이노
- Visual Micro
- 운영체제
- set
- directx
Archives
- Today
- Total
Kim's Programming
1284. 수도 요금 경쟁 본문
1284. 수도 요금 경쟁
문제출처: https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV189xUaI8UCFAZN&categoryId=AV189xUaI8UCFAZN&categoryType=CODE
풀이 방법
<코드>
#include <iostream> int main() { int n{ 0 }; std::cin >> n; for (int testCase = 1; testCase <= n; testCase++) { int p,q,r,s,w; std::cin>>p>>q>>r>>s>>w; int value1 = p * w; int value2; if(w<r) value2 = q; else value2 = q + s*(w-r); std::cout << "#" << testCase << " " << (value1<value2 ? value1 : value2)<< "\n"; } return 0; }
'SW ExpertAcademy > D2' 카테고리의 다른 글
1940. 가랏! RC카! (0) | 2018.12.01 |
---|---|
1928. Base64 Decoder (0) | 2018.12.01 |
1288. 새로운 불면증 치료법 (0) | 2018.12.01 |
1285. 아름이의 돌 던지기 (0) | 2018.11.30 |
1204. [S/W 문제해결 기본] 1일차 - 최빈수 구하기 (0) | 2018.11.30 |