피너클의 it공부방
백준 2720 세탁소 사장 동혁 (c++) : 피너클 본문
728x90
반응형
https://www.acmicpc.net/problem/2720
단순 수학 문제다.
#include <iostream>
#include <algorithm>
using namespace std;
int test, c;
int Quarter = 25;
int Dime = 10;
int Nickel = 5;
int Penny = 1;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> test;
while (test-- > 0) {
cin >> c;
cout << c / Quarter << ' ';
c %= Quarter;
cout << c / Dime << ' ';
c %= Dime;
cout << c / Nickel << ' ';
c %= Nickel;
cout << c / Penny << ' ';
c %= Penny;
}
}
전체코드다.
728x90
반응형
Comments