1 개요[ | ]
- SWEA 5688 세제곱근을 찾아라
# | 문제 | 풀이 |
---|
2 C++[ | ]
C++
3 Java[ | ]
Java
Copy
import java.util.*;
class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T;
T=sc.nextInt();
long N, x;
for(int test_case = 1; test_case <= T; test_case++) {
N = sc.nextLong();
x = (long) Math.floor(Math.cbrt(N));
if( x*x*x != N ) x = -1;
System.out.format("#%d %d\n", test_case, x);
}
sc.close();
}
}
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.