We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4de98c7 commit 5169f33Copy full SHA for 5169f33
LiiNi-coder/202602/17 BOJ 다이어트.md
@@ -0,0 +1,34 @@
1
+```java
2
+import java.io.BufferedReader;
3
+import java.io.IOException;
4
+import java.io.InputStreamReader;
5
+
6
+public class Main {
7
+ public static void main(String[] args) throws IOException {
8
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
9
+ int G = Integer.parseInt(br.readLine());
10
+ long old = 1;
11
+ long now = 2;
12
+ boolean isFind = false;
13
14
+ while (now <= 100000 && old < now) {
15
+ long diff = now * now - old * old;
16
+ if (diff == G) {
17
+ System.out.println(now);
18
+ isFind = true;
19
+ old++;
20
+ } else if (diff < G) {
21
+ now++;
22
+ } else {
23
24
+ }
25
26
27
28
+ if (!isFind) {
29
+ System.out.println(-1);
30
31
32
+}
33
34
+```
0 commit comments