문제 링크입니다: www.acmicpc.net/problem/10179
10179번: 쿠폰
당신은 어떤 물건이라도 20% 할인해주는 쿠폰을 가지고 있다. 원래 가격이 주어질 때, 쿠폰을 사용하면 얼마가 되는지 알려주는 프로그램을 작성하시오.
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; | |
int main(void) | |
{ | |
int T; | |
cin >> T; | |
for (int t = 0; t < T; t++) | |
{ | |
double price; | |
cin >> price; | |
double result = price * 0.8; | |
printf("$%.2lf\n", result); | |
} | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
[KOI 초등부] 백준 10797번 10부제 (0) | 2021.03.14 |
---|---|
백준 10768번 특별한 날 (0) | 2021.03.14 |
[KOI 초등부] 백준 10156번 과자 (0) | 2021.03.14 |
백준 10101번 삼각형 외우기 (0) | 2021.03.14 |
백준 10039번 평균 점수 (0) | 2021.03.14 |