結果
問題 | No.1113 二つの整数 / Two Integers |
ユーザー |
|
提出日時 | 2020-08-19 19:06:50 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 295 ms / 1,000 ms |
コード長 | 1,025 bytes |
コンパイル時間 | 10,679 ms |
コンパイル使用メモリ | 436,032 KB |
実行使用メモリ | 54,432 KB |
最終ジャッジ日時 | 2024-10-12 05:13:49 |
合計ジャッジ時間 | 16,328 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
import java.io.BufferedReaderimport java.io.InputStreamimport java.io.InputStreamReaderimport java.io.PrintWriterimport java.util.*fun gcd(a:Long, b:Long):Long {val c = a % bif (c == 0L) return breturn gcd(b, c)}fun PrintWriter.solve(sc: FastScanner) {val a = sc.nextLong()val b = sc.nextLong()val d = gcd(a, b)val r = Math.round(Math.sqrt(d.toDouble()))println(if (r * r == d) "Odd" else "Even")}fun main() {val writer = PrintWriter(System.out, false)writer.solve(FastScanner(System.`in`))writer.flush()}class FastScanner(s: InputStream) {private var st = StringTokenizer("")private val br = BufferedReader(InputStreamReader(s))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()fun ready() = br.ready()}