結果
問題 | No.1593 Perfect Distance |
ユーザー | 👑 箱 |
提出日時 | 2021-07-09 21:25:37 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 284 ms / 2,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 12,198 ms |
コンパイル使用メモリ | 422,104 KB |
実行使用メモリ | 50,648 KB |
最終ジャッジ日時 | 2023-09-14 07:39:27 |
合計ジャッジ時間 | 19,151 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 275 ms
50,484 KB |
testcase_01 | AC | 266 ms
50,488 KB |
testcase_02 | AC | 264 ms
50,420 KB |
testcase_03 | AC | 262 ms
50,456 KB |
testcase_04 | AC | 263 ms
50,420 KB |
testcase_05 | AC | 271 ms
50,432 KB |
testcase_06 | AC | 270 ms
50,340 KB |
testcase_07 | AC | 270 ms
50,352 KB |
testcase_08 | AC | 267 ms
50,432 KB |
testcase_09 | AC | 266 ms
50,648 KB |
testcase_10 | AC | 267 ms
50,456 KB |
testcase_11 | AC | 281 ms
50,436 KB |
testcase_12 | AC | 277 ms
50,492 KB |
testcase_13 | AC | 277 ms
50,476 KB |
testcase_14 | AC | 276 ms
50,624 KB |
testcase_15 | AC | 279 ms
50,568 KB |
testcase_16 | AC | 284 ms
50,632 KB |
testcase_17 | AC | 267 ms
50,556 KB |
testcase_18 | AC | 273 ms
50,320 KB |
testcase_19 | AC | 273 ms
50,436 KB |
ソースコード
import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val n = nextLong() var count = 0 for (x in 1 until n) { val y2 = n * n - x * x val y = sqrt(y2.toDouble()).roundToLong() if (y * y == y2) count++ } println(count) } fun main() { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion