結果
問題 | No.1224 I hate Sqrt Inequality |
ユーザー |
|
提出日時 | 2020-09-17 23:40:27 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 260 ms / 2,000 ms |
コード長 | 1,051 bytes |
コンパイル時間 | 9,573 ms |
コンパイル使用メモリ | 426,500 KB |
実行使用メモリ | 54,440 KB |
最終ジャッジ日時 | 2024-06-22 07:18:52 |
合計ジャッジ時間 | 14,124 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.io.PrintWriter import java.util.* fun gcd(a:Long, b:Long):Long { val c = a % b if (c == 0L) return b return gcd(b, c) } fun PrintWriter.solve(sc: FastScanner) { val a = sc.nextLong() val b = sc.nextLong() val d = gcd(a, b) var m = b / d while (m % 2 == 0L) m /= 2 while (m % 5 == 0L) m /= 5 println(if (m != 1L) "Yes" else "No") } 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() }