結果

問題 No.1593 Perfect Distance
ユーザー kinkincindy
提出日時 2021-07-09 22:31:59
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 601 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 74,064 KB
実行使用メモリ 46,960 KB
最終ジャッジ日時 2024-07-01 17:10:57
合計ジャッジ時間 9,784 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other AC * 12 TLE * 1 -- * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.lang.reflect.Array;
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = Integer.parseInt(sc.next());
        long count = 0;
        for (long y = 1; y <= n; y++){
            long xx = (n + y) * (n - y);
            if (issquared(xx)){
                count++;
            }
        }
        System.out.print(count);
    }

    private static boolean issquared(long num){
        for (int i = 1; i * i <= num; i++){
            if (i * i == num) return true;
        }
        return false;
    }
}
0