結果

問題 No.1593 Perfect Distance
ユーザー fukafukatanifukafukatani
提出日時 2021-07-13 22:34:34
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,390 ms / 2,000 ms
コード長 211 bytes
コンパイル時間 8,158 ms
コンパイル使用メモリ 250,408 KB
実行使用メモリ 81,072 KB
最終ジャッジ日時 2023-09-15 15:10:34
合計ジャッジ時間 32,139 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,017 ms
64,608 KB
testcase_01 AC 1,038 ms
65,680 KB
testcase_02 AC 1,020 ms
64,996 KB
testcase_03 AC 1,028 ms
64,728 KB
testcase_04 AC 1,030 ms
64,868 KB
testcase_05 AC 1,023 ms
65,080 KB
testcase_06 AC 1,022 ms
65,180 KB
testcase_07 AC 1,024 ms
65,084 KB
testcase_08 AC 1,048 ms
65,968 KB
testcase_09 AC 1,108 ms
65,156 KB
testcase_10 AC 1,119 ms
65,284 KB
testcase_11 AC 1,179 ms
67,216 KB
testcase_12 AC 1,214 ms
69,488 KB
testcase_13 AC 1,198 ms
69,608 KB
testcase_14 AC 1,268 ms
70,224 KB
testcase_15 AC 1,315 ms
78,164 KB
testcase_16 AC 1,390 ms
81,072 KB
testcase_17 AC 1,028 ms
64,948 KB
testcase_18 AC 1,023 ms
64,952 KB
testcase_19 AC 1,020 ms
65,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextLong
  val s = (1l to n).map(p => p * p).toSet
  val ans = (1l to n).count(p => s.contains(n * n - p * p))
  println(ans)
}
0