티스토리 뷰
https://www.acmicpc.net/problem/1476
브루트포스 + 단순 구현 문제.
import java.util.Scanner;
public class Main{
public static Scanner sc;
public static int E, S, M;
public static void main(String[] args)
{
solve();
}
public static void solve(){
input();
bruteforce();
}
public static void input(){
sc = new Scanner(System.in);
E = sc.nextInt();
S = sc.nextInt();
M = sc.nextInt();
}
public static void bruteforce(){
int year = 1;
int e_cnt = 1;
int s_cnt = 1;
int m_cnt = 1;
while(true){
if(e_cnt == E && s_cnt == S && m_cnt == M)
break;
year++;
e_cnt++;
s_cnt++;
m_cnt++;
if(e_cnt > 15)
e_cnt = 1;
if(s_cnt > 28)
s_cnt = 1;
if(m_cnt > 19)
m_cnt = 1;
}
System.out.println(year);
}
}
'알고리즘' 카테고리의 다른 글
백준 실버II. 1182번 부분수열의 합 (0) | 2022.05.03 |
---|---|
실버I. 백준2293 동전1 (0) | 2021.12.14 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- https://velog.io/@juno7803/React%EA%B0%80-%ED%83%9C%EC%96%B4%EB%82%9C-%EB%B0%B0%EA%B2%BD
- Co
- https://wikidocs.net/68
- ㄴ
- https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
- https://react.vlpt.us/basic/11-render-array.html
- https://jwprogramming.tistory.com/52
- https://react.vlpt.us/
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함