Submission #730901


Source Code Expand

object Main extends App {
  import java.{ util => ju }
  import scala.annotation._
  import scala.collection._
  import scala.collection.{ mutable => mu }
  import scala.collection.JavaConverters._
  import scala.math._

  val sc = new ju.Scanner(System.in)

  solveB()

  def solveA() {
    println(sc.nextInt() - sc.nextInt())
  }

  def solveB() {
    val m = sc.nextInt()

    val s = m match {
      case (a) if a < 100    => "00"
      case (a) if a < 6000   => "%02d".format(a / 100)
      case (a) if a < 35000  => a / 1000 + 50
      case (a) if a <= 70000 => (a / 1000 - 30) / 5 + 80
      case _                 => "89"
    }

    println(s)
  }

  def solveC() {
    val deg, dis = sc.nextInt()
    val sPerm = scala.math.BigDecimal(dis.toDouble / 60.0).setScale(1, scala.math.BigDecimal.RoundingMode.HALF_UP).toDouble
    val windPow = getWindPower(sPerm)
    if (windPow == 0) {
      println("C 0")
      return
    }
    val windDir = getWindDir(deg)
    println(windDir + " " + windPow)
  }

  def getWindDir(s: Int): String = {
    var index = 112
    s match {
      case (a) if a <= index           => "N"
      case (a) if a <= index + 225 * 1 => "NNE"
      case (a) if a <= index + 225 * 2 => "NE"
      case (a) if a <= index + 225 * 3 => "ENE"
      case (a) if a <= 1012            => "E"
      case (a) if a <= 1237            => "ESE"
      case (a) if a <= 1462            => "SE"
      case (a) if a <= 1687            => "SSE"
      case (a) if a <= 1912            => "S"
      case (a) if a <= 2137            => "SSW"
      case (a) if a <= 2362            => "SW"
      case (a) if a <= 2587            => "WSW"
      case (a) if a <= 2812            => "W"
      case (a) if a <= 3037            => "WNW"
      case (a) if a <= 3262            => "NW"
      case (a) if a <= 3487            => "NNW"
      case _                           => "N"
    }
  }

  def getWindPower(s: Double): Int = {
    s match {
      case (a) if a < 0.3  => 0
      case (a) if a < 1.6  => 1
      case (a) if a < 3.4  => 2
      case (a) if a < 5.5  => 3
      case (a) if a < 8.0  => 4
      case (a) if a < 10.8 => 5
      case (a) if a < 13.9 => 6
      case (a) if a < 17.2 => 7
      case (a) if a < 20.8 => 8
      case (a) if a < 24.5 => 9
      case (a) if a < 28.5 => 10
      case (a) if a < 32.7 => 11
      case _               => 12
    }
  }
}

Submission Info

Submission Time
Task B - 視程の通報
User tochukaso
Language Scala (2.9.1)
Score 100
Code Size 2462 Byte
Status AC
Exec Time 1088 ms
Memory 39456 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 38
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1088 ms 39208 KB
00_sample_02.txt AC 838 ms 39136 KB
00_sample_03.txt AC 838 ms 39400 KB
test_01.txt AC 826 ms 39364 KB
test_02.txt AC 818 ms 39288 KB
test_03.txt AC 834 ms 39280 KB
test_04.txt AC 830 ms 39340 KB
test_05.txt AC 828 ms 39164 KB
test_06.txt AC 858 ms 39220 KB
test_07.txt AC 858 ms 39352 KB
test_08.txt AC 851 ms 39360 KB
test_09.txt AC 890 ms 39336 KB
test_10.txt AC 830 ms 39316 KB
test_11.txt AC 823 ms 39180 KB
test_12.txt AC 823 ms 39296 KB
test_13.txt AC 822 ms 39192 KB
test_14.txt AC 820 ms 39276 KB
test_15.txt AC 832 ms 39268 KB
test_16.txt AC 845 ms 39456 KB
test_17.txt AC 856 ms 39436 KB
test_18.txt AC 847 ms 39312 KB
test_19.txt AC 858 ms 39452 KB
test_20.txt AC 865 ms 39456 KB
test_21.txt AC 845 ms 39336 KB
test_22.txt AC 833 ms 39284 KB
test_23.txt AC 814 ms 39400 KB
test_24.txt AC 825 ms 39216 KB
test_25.txt AC 825 ms 39284 KB
test_26.txt AC 818 ms 39392 KB
test_27.txt AC 846 ms 39224 KB
test_28.txt AC 832 ms 39348 KB
test_29.txt AC 841 ms 39244 KB
test_30.txt AC 851 ms 39292 KB
test_31.txt AC 853 ms 39216 KB
test_32.txt AC 841 ms 39320 KB
test_33.txt AC 854 ms 39320 KB
test_34.txt AC 845 ms 39268 KB
test_35.txt AC 838 ms 39360 KB