結果
問題 |
No.1593 Perfect Distance
|
ユーザー |
![]() |
提出日時 | 2021-07-09 22:31:55 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 601 bytes |
コンパイル時間 | 2,617 ms |
コンパイル使用メモリ | 75,304 KB |
実行使用メモリ | 61,228 KB |
最終ジャッジ日時 | 2024-07-01 17:10:33 |
合計ジャッジ時間 | 9,621 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 12 TLE * 1 -- * 4 |
ソースコード
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; } }