문제 링크입니다: https://www.acmicpc.net/problem/5361
5361번: 전투 드로이드 가격
각 테스트 케이스 마다, 입력으로 주어진 부품을 모두 구매하는데 필요한 비용을 소수점 둘째 자리까지 출력한다. 달러 표시도 출력해야 한다. 정답은 1억보다 작거나 같다.
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const double BLASTER_RIFLE = 350.34; | |
const double VISUAL_SENSOR = 230.90; | |
const double AUDITORY_SENSOR = 190.55; | |
const double ARM = 125.30; | |
const double LEG = 180.90; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int T; | |
cin >> T; | |
for (int t = 0; t < T; t++) | |
{ | |
int A, B, C, D, E; | |
cin >> A >> B >> C >> D >> E; | |
double result = A * BLASTER_RIFLE | |
+ B * VISUAL_SENSOR | |
+ C * AUDITORY_SENSOR | |
+ D * ARM | |
+ E * LEG; | |
printf("$%.2lf\n", result); | |
} | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 5565번 영수증 (2) | 2021.05.19 |
---|---|
백준 5523번 경기 결과 (0) | 2021.05.19 |
백준 5354번 J박스 (0) | 2021.05.19 |
백준 5235번 Even Sum More Than Odd Sum (0) | 2021.05.19 |
백준 5220번 Error Detection (0) | 2021.05.19 |