Skip to content

Commit 3ebe85f

Browse files
committed
[20251108] PGM / LV2 / 카펫 / 김민진
1 parent de2dc13 commit 3ebe85f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```java
2+
public class PGM_LV2_카펫 {
3+
4+
public int[] solution(int B, int Y) {
5+
int mul = B + Y;
6+
int sum = (B + 4) / 2;
7+
8+
int sqrt = (int) Math.sqrt(sum * sum - 4 * (B + Y));
9+
10+
int a = (sum + sqrt) / 2;
11+
int b = (sum - sqrt) / 2;
12+
13+
return new int[] { a, b };
14+
}
15+
}
16+
```

0 commit comments

Comments
 (0)