문제 링크입니다: https://www.acmicpc.net/problem/5565
5565번: 영수증
첫째 줄에 10권의 총 가격이 주어진다. 둘째 줄부터 9개 줄에는 가격을 읽을 수 있는 책 9권의 가격이 주어진다. 책의 가격은 10,000이하인 양의 정수이다.
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) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int totalSum = 0; | |
cin >> totalSum; | |
int sum = 0; | |
for (int i = 0; i < 9; i++) | |
{ | |
int cost; | |
cin >> cost; | |
sum += cost; | |
} | |
cout << totalSum - sum << "\n"; | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 1802번 종이 접기 (1) | 2021.05.20 |
---|---|
백준 5607번 問題 1 (2) | 2021.05.20 |
백준 5523번 경기 결과 (0) | 2021.05.19 |
백준 5361번 전투 드로이드 가격 (0) | 2021.05.19 |
백준 5354번 J박스 (0) | 2021.05.19 |