Skip to content

Commit 2915e6a

Browse files
authored
Create 25_sumOfSquare.java
1 parent 03d4b88 commit 2915e6a

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+
public class Solution {
2+
public boolean judgeSquareSum(int c) {
3+
for (int i = 2; i * i <= c; i++) {
4+
int count = 0;
5+
if (c % i == 0) {
6+
while (c % i == 0) {
7+
count++;
8+
c /= i;
9+
}
10+
if (i % 4 == 3 && count % 2 != 0)
11+
return false;
12+
}
13+
}
14+
return c % 4 != 3;
15+
}
16+
}

0 commit comments

Comments
 (0)