From cdeb2ffe458555b2eede6e508c4293ed10893d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=88=98=EB=AF=BC?= Date: Fri, 3 Jan 2025 17:44:00 +0900 Subject: [PATCH] CT_350 --- ...\353\247\236\354\266\224\352\270\260.java" | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 "BOJ/Java/src/S5/Boj_32403_\354\240\204\352\265\254\354\243\274\352\270\260\353\247\236\354\266\224\352\270\260.java" diff --git "a/BOJ/Java/src/S5/Boj_32403_\354\240\204\352\265\254\354\243\274\352\270\260\353\247\236\354\266\224\352\270\260.java" "b/BOJ/Java/src/S5/Boj_32403_\354\240\204\352\265\254\354\243\274\352\270\260\353\247\236\354\266\224\352\270\260.java" new file mode 100644 index 0000000..96466f1 --- /dev/null +++ "b/BOJ/Java/src/S5/Boj_32403_\354\240\204\352\265\254\354\243\274\352\270\260\353\247\236\354\266\224\352\270\260.java" @@ -0,0 +1,31 @@ +package S5; + +import java.io.*; +import java.util.StringTokenizer; + +public class Boj_32403_전구주기맞추기 { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + int N = Integer.parseInt(st.nextToken()); + int T = Integer.parseInt(st.nextToken()); + + st = new StringTokenizer(br.readLine()); + int min = 0; + + for (int i = 0; i < N; i++) { + int time = Integer.parseInt(st.nextToken()); + for (int j = 0; j < time; j++) { + if (T % (time - j) == 0 || T % (time + j) == 0) { + min += j; + break; + } + } + } + + bw.write(Integer.toString(min)); + bw.flush(); + } +}