結果
問題 | No.312 置換処理 |
ユーザー |
![]() |
提出日時 | 2015-12-05 19:02:21 |
言語 | Scala(Beta) (3.6.2) |
結果 |
AC
|
実行時間 | 840 ms / 2,000 ms |
コード長 | 404 bytes |
コンパイル時間 | 8,800 ms |
コンパイル使用メモリ | 252,376 KB |
実行使用メモリ | 63,408 KB |
最終ジャッジ日時 | 2024-06-11 08:48:10 |
合計ジャッジ時間 | 46,586 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 45 |
ソースコード
import math._ object Main { def calc(n: Long): Long = { if (n % 3 == 0) return 3 if (n % 4 == 0) return 4 var x = n while (x % 2 == 0) x /= 2 var p = 3L while (p * p <= x) { if (x % p == 0) return p p += 2 } x } def main(args: Array[String]) = { val sc = new java.util.Scanner(System.in) val n = sc.nextLong println(calc(n)) } }