백준/C
[BaeKJoon/C] 백준21300 c Bottle Return
coose
2021. 5. 22. 15:46
반응형
https://www.acmicpc.net/problem/21300
21300번: Bottle Return
In the United States, beverage container deposit laws, or so-called bottle bills, are designed to reduce litter and reclaim bottles, cans and other containers for recycling. Ten states currently have some sort of deposit-refund systems in place for differe
www.acmicpc.net
문제
당신은 뉴욕 주의 빈 컨테이너의 주어진 수집에 대해 고객이 환불받을 금액을 계산할 것이다. 뉴욕의 규칙은 매우 간단하다: 맥주, 맥아, 와인 제품, 탄산 음료, 셀처, 물(설탕을 포함하지 않음)을 포함한 1갤런 미만의 모든 크기의 용기에 대한 보증금이 5파운드이다.
풀이
맥주, 맥아, 와인 제품, 탄산 음료, 셀처, 물(설탕을 포함하지 않음) 6개의 값을 입력한뒤에 각각 값을 5 곱해서 더하면 된다.
코드
#include <stdio.h>
int main() {
int n;
int sum = 0;
for (int i = 0; i < 6; i++) {
scanf("%d", &n);
sum += n * 5;
}
printf("%d", sum);
}
|
cs |
반응형