結果

問題 No.339 何人が回答したのか
コンテスト
ユーザー yudedako
提出日時 2016-01-31 16:44:07
言語 Scala(Beta)
(3.8.2)
コンパイル:
scalac _filename_
実行:
/usr/bin/scala_run _class_
結果
AC  
実行時間 448 ms / 1,000 ms
コード長 444 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,857 ms
コンパイル使用メモリ 264,628 KB
実行使用メモリ 65,116 KB
最終ジャッジ日時 2026-03-09 14:36:59
合計ジャッジ時間 41,658 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

object Yuki extends App{
  import scala.io.StdIn.readLine
  def gcd(a:Int, b:Int):Int = {
    b match {
      case 0 => a
      case _ => gcd(b, a % b)
    }
  }
  def foldr[a, b](f:(a, b)=>b, list:List[a], init:b):b = {
    list match{
      case Nil => init
      case h::tail => foldr(f, tail, f(h, init))
    }
  }
  val n = readLine.toInt
  val list = for (_ <- (1 to n).toList) yield readLine.toInt
  println(100 / foldr(gcd, list, 0))
}
0