Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
278 B
2
Indexable
Never
public static int findMinPow(int n){
        for(int i=2;;i++){
            int j = (int) Math.sqrt(i*i-n);
            if(i*i-j*j==n){
                return i;
            }
            if(i*i>Math.pow(10,9)){
                return -1;
            }
        }
    }