結果
| 問題 |
No.236 鴛鴦茶
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-07-05 23:09:38 |
| 言語 | Scala(Beta) (3.6.2) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,259 bytes |
| コンパイル時間 | 14,761 ms |
| コンパイル使用メモリ | 273,284 KB |
| 実行使用メモリ | 70,916 KB |
| 最終ジャッジ日時 | 2025-03-13 19:35:45 |
| 合計ジャッジ時間 | 21,758 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 22 |
ソースコード
import scala.io.StdIn.readLine
import scala.collection.mutable.PriorityQueue
import scala.annotation.tailrec
// PriorityQueue[Long]()(scala.math.Ordering.Long.reverse)
object Lib {
object Number {
// @return Array length is equal to 'n'.
// Kth element of Array is true if K is prime else false.
final def sieve(n : Int) : Array[Boolean] = {
val isprime = Array.fill(n+1)(true)
isprime(0) = false
isprime(1) = false
for(i <- 2 to Math.ceil(Math.sqrt(n.toDouble)).toInt;
if isprime(i);
j <- i*i to n by i){
isprime(j) = false
}
isprime
}
// @return Array of primes that is less than or equal to n
final def primes(n : Int) : Array[Int] =
sieve(n).zipWithIndex.withFilter(_._1).map(_._2)
}
object EnRich {
implicit class AString(val self : String) extends AnyVal {
def splitToIntArray = self.split(" ").map(_.toInt)
}
}
}
import Lib.EnRich._
object Main {
def main(args : Array[String]) : Unit = {
val (a,b,x,y) = {
val abxy = readLine().splitToIntArray.map(_.toDouble)
(abxy(0),abxy(1),abxy(2),abxy(3))
}
val ret = if(x/a <= y/b) x+x/a*b // many cofee
else y+y/b*a //many tea
println(ret)
}
}