https://www.acmicpc.net/problem/1476
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
void CPP_INIT() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main(void) {
CPP_INIT();
int E, S, M;
int ans = -1;
cin >> E >> S >> M;
while (E != 1 || S != 1 || M != 1) {
E--;
S--;
M--;
if (E < 1) E = 15;
if (S < 1) S = 28;
if (M < 1) M = 19;
ans--;
}
cout << abs(ans);
}
'알고리즘' 카테고리의 다른 글
C++ 알고리즘 - 4673 셀프 넘버 (0) | 2025.01.19 |
---|---|
C++ 알고리즘 - 1748 수 이어 쓰기 1 (0) | 2025.01.19 |
C++ 알고리즘 - 백준 2309 일곱 난쟁이 (0) | 2025.01.19 |
C++ 알고리즘 - 백준 6588 골드바흐의 추측 (0) | 2025.01.19 |
C++ 알고리즘 - 백준 17427 약수의 합 2 (0) | 2025.01.19 |