結果
問題 | No.1593 Perfect Distance |
ユーザー | Asahi |
提出日時 | 2023-02-04 19:34:19 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,085 bytes |
コンパイル時間 | 1,900 ms |
コンパイル使用メモリ | 75,192 KB |
実行使用メモリ | 57,540 KB |
最終ジャッジ日時 | 2023-09-16 16:06:07 |
合計ジャッジ時間 | 5,347 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 123 ms
55,460 KB |
testcase_01 | AC | 127 ms
55,264 KB |
testcase_02 | AC | 124 ms
55,484 KB |
testcase_03 | AC | 121 ms
55,376 KB |
testcase_04 | AC | 124 ms
55,684 KB |
testcase_05 | AC | 124 ms
55,584 KB |
testcase_06 | AC | 122 ms
55,220 KB |
testcase_07 | AC | 123 ms
55,368 KB |
testcase_08 | AC | 122 ms
55,328 KB |
testcase_09 | AC | 125 ms
55,276 KB |
testcase_10 | AC | 125 ms
56,000 KB |
testcase_11 | AC | 127 ms
55,504 KB |
testcase_12 | AC | 129 ms
57,540 KB |
testcase_13 | AC | 133 ms
55,328 KB |
testcase_14 | AC | 127 ms
55,468 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 122 ms
55,036 KB |
testcase_18 | AC | 122 ms
55,284 KB |
testcase_19 | AC | 124 ms
55,404 KB |
ソースコード
import java.util.*; import java.io.*; import java.math.*; import java.util.stream.Stream; public class Main{ /* 入出力 */ static BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter output = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); /* 定数 */ static final int [] y4 = {0,1,0,-1}; static final int [] x4 = {1,0,-1,0}; static final int INF1 = Integer.MAX_VALUE; static final long INF2 = Long.MAX_VALUE; static final long MOD1 = (long)1e9+7; static final long MOD2 = 998244353; /* Main */ public static void main(String[] args) throws IOException{ long n = sc.nextLong(); long ans = 0; for(long x = 1; x <= 100000; x++) { long y = n*n - x*x; if(y <= 0 || !isInteger(Math.sqrt(y))) continue; ans++; } output.print(ans); output.flush(); } static boolean isInteger (double value) { return (value == Math.floor(value)); } }