-
백준 10162번: 전자레인지정수론(Number theory) 2018. 7. 23. 12:04반응형
https://www.acmicpc.net/problem/10162
1. 문제
단순한 수학 구현 문제
2. 알고리즘
키워드 - 수학
3. 코드
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#include <iostream>#include <sstream>#include <string>#include <algorithm>#include <functional>#include <vector>#include <list>#include <queue>#include <deque>#include <map>#include <set>#include <stack>#include <cstring>#include <math.h>using namespace std;#define MAX_SIZE 100#define INF 0x7fffffff#define CENDL "\n"#define ll long longint main() {cin.tie(0);std::ios::sync_with_stdio(false);int n; cin >> n;int sol_a = n / 300;if (sol_a) {n = n - sol_a * 300;}int sol_b = 0;sol_b = n / 60;if (sol_b) {n = n - sol_b * 60;}int sol_c = 0;sol_c = n / 10;if (sol_c) {n = n - sol_c * 10;}if (n != 0 || sol_a == 0 && sol_b == 0 && sol_c == 0) {cout << -1 << CENDL;} else {cout << sol_a << " " << sol_b << " " << sol_c << CENDL;}return 0;}cs 반응형'정수론(Number theory)' 카테고리의 다른 글
백준 5692번: 팩토리얼 진법 (0) 2018.08.06 백준 10474번: 분수좋아해? (0) 2018.07.23 백준 1977번: 완전제곱수 (0) 2018.07.19 백준 1712번: 손익분기점 (0) 2018.07.19 백준 1357번: 뒤집힌 덧셈 (0) 2018.07.19