BOJ : https://www.acmicpc.net/problem/1476

github : https://github.com/junho0956/Algorithm/blob/master/1476/1476/%EC%86%8C%EC%8A%A4.cpp

 

e, s, m 이 주어지면

e 를 고정시키고 s m 이 정확히 맞아 떨어질때까지 무한탐색하였습니다.

 

더보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
using namespace std;
 
int main() {
    int e, s, m;
    cin >> e >> s >> m;
 
    int total = 1;
    int ss = 1, mm = 1;
 
    ss += (e - 1);
    mm += (e - 1);
 
    total += (e - 1);
    while (1) {
        if (ss == s && mm == m) break;
        ss += 15, mm += 15;
        if (ss > 28) ss %= 28;
        if (mm > 19) mm %= 19;
        total += 15;
    }
 
    cout << total;
    return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter

'algorithm > BOJ' 카테고리의 다른 글

BOJ 1451번 직사각형으로 나누기  (0) 2020.01.21
BOJ 1107번 리모컨  (0) 2020.01.21
BOJ 1744번 수 묶기  (0) 2020.01.17
BOJ 11399번 ATM  (0) 2020.01.17
BOJ 1931번 회의실 배정  (0) 2020.01.17

+ Recent posts