문제 링크 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV189xUaI8UCFAZN
문제의 저작권은 SW Expert Academy에 있습니다.
#include <iostream> using namespace std; int main(void) { int T, P, Q, R, S, W; cin >> T; for(int t_case=0; t_case<T; t_case++) { int Aprice, Bprice; cin >> P >> Q >> R >> S >> W; Aprice = W * P; if(W <= R) Bprice = Q; else { Bprice = Q + (W-R) * S; } cout << "#" << t_case+1 << " " << (Aprice<Bprice ? Aprice : Bprice) << "\n"; } return 0; } | cs |
'C & C++ > SW Expert Academy' 카테고리의 다른 글
SWEA 3376 - 파도반 수열 (0) | 2018.04.28 |
---|---|
SWEA 1289 - 원재의 메모리 복구하기 (0) | 2018.04.28 |
SWEA 1285 - 아름이의 돌 던지기 (0) | 2018.04.28 |
SWEA 1288 - 새로운 불면증 치료법 (0) | 2018.04.28 |
SWEA 1928 - Base64 Decoder (0) | 2018.04.28 |