Submission #172964
Source Code Expand
object Main extends App { val table1 = Array("N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW") val table2 = """\d+\.\d""".r.findAllIn( """ 風力0 0.0m⁄s 以上 0.2m⁄s 以下 風力5 8.0m⁄s 以上 10.7m⁄s 以下 風力10 24.5m⁄s 以上 28.4m⁄s 以下 風力1 0.3m⁄s 以上 1.5m⁄s 以下 風力6 10.8m⁄s 以上 13.8m⁄s 以下 風力11 28.5m⁄s 以上 32.6m⁄s 以下 風力2 1.6m⁄s 以上 3.3m⁄s 以下 風力7 13.9m⁄s 以上 17.1m⁄s 以下 風力12 32.7m⁄s 以上 9999999.0m/s 風力3 3.4m⁄s 以上 5.4m⁄s 以下 風力8 17.2m⁄s 以上 20.7m⁄s 以下 風力4 5.5m⁄s 以上 7.9m⁄s 以下 風力9 20.8m⁄s 以上 24.4m⁄s 以下""").map(x => (x.toDouble * 10).round).toArray.grouped(2).toArray.sortBy(_.head).zipWithIndex def disTo風力(dis: Int): Int = { val x10 = (dis / 60.0 * 10).round table2.find { case (Array(a, b), _) => x10 >= a && x10 <= b}.get._2 } val Array(deg, dis) = readLine.split(" ").map(_.toInt) val i = (deg * 10 + 1125) / 2250 % 16 val w = disTo風力(dis) val dir = if (w == 0) "C" else table1(i) println(dir + " " + w) }
Submission Info
Submission Time | |
---|---|
Task | C - 風力観測 |
User | awekuit |
Language | Scala (2.9.1) |
Score | 100 |
Code Size | 1381 Byte |
Status | AC |
Exec Time | 1052 ms |
Memory | 42896 KB |
Judge Result
Set Name | all | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
all | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 00_sample_06.txt, 00_sample_07.txt, 00_sample_08.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, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1052 ms | 42820 KB |
00_sample_02.txt | AC | 958 ms | 42868 KB |
00_sample_03.txt | AC | 967 ms | 42760 KB |
00_sample_04.txt | AC | 960 ms | 42752 KB |
00_sample_05.txt | AC | 971 ms | 42880 KB |
00_sample_06.txt | AC | 993 ms | 42840 KB |
00_sample_07.txt | AC | 955 ms | 42828 KB |
00_sample_08.txt | AC | 958 ms | 42756 KB |
test_01.txt | AC | 931 ms | 42732 KB |
test_02.txt | AC | 945 ms | 42748 KB |
test_03.txt | AC | 955 ms | 42776 KB |
test_04.txt | AC | 955 ms | 42872 KB |
test_05.txt | AC | 956 ms | 42772 KB |
test_06.txt | AC | 940 ms | 42844 KB |
test_07.txt | AC | 966 ms | 42784 KB |
test_08.txt | AC | 956 ms | 42768 KB |
test_09.txt | AC | 939 ms | 42744 KB |
test_10.txt | AC | 950 ms | 42756 KB |
test_11.txt | AC | 939 ms | 42880 KB |
test_12.txt | AC | 938 ms | 42756 KB |
test_13.txt | AC | 1021 ms | 42756 KB |
test_14.txt | AC | 973 ms | 42624 KB |
test_15.txt | AC | 952 ms | 42748 KB |
test_16.txt | AC | 965 ms | 42772 KB |
test_17.txt | AC | 954 ms | 42712 KB |
test_18.txt | AC | 940 ms | 42760 KB |
test_19.txt | AC | 953 ms | 42760 KB |
test_20.txt | AC | 943 ms | 42752 KB |
test_21.txt | AC | 937 ms | 42768 KB |
test_22.txt | AC | 976 ms | 42792 KB |
test_23.txt | AC | 977 ms | 42720 KB |
test_24.txt | AC | 958 ms | 42768 KB |
test_25.txt | AC | 970 ms | 42776 KB |
test_26.txt | AC | 944 ms | 42876 KB |
test_27.txt | AC | 953 ms | 42828 KB |
test_28.txt | AC | 958 ms | 42872 KB |
test_29.txt | AC | 931 ms | 42880 KB |
test_30.txt | AC | 926 ms | 42880 KB |
test_31.txt | AC | 961 ms | 42740 KB |
test_32.txt | AC | 949 ms | 42896 KB |
test_33.txt | AC | 941 ms | 42876 KB |
test_34.txt | AC | 938 ms | 42760 KB |
test_35.txt | AC | 939 ms | 42828 KB |
test_36.txt | AC | 942 ms | 42756 KB |
test_37.txt | AC | 937 ms | 42856 KB |
test_38.txt | AC | 973 ms | 42872 KB |
test_39.txt | AC | 954 ms | 42844 KB |
test_40.txt | AC | 977 ms | 42768 KB |
test_41.txt | AC | 956 ms | 42752 KB |
test_42.txt | AC | 956 ms | 42868 KB |
test_43.txt | AC | 949 ms | 42836 KB |
test_44.txt | AC | 963 ms | 42804 KB |
test_45.txt | AC | 967 ms | 42752 KB |
test_46.txt | AC | 958 ms | 42688 KB |
test_47.txt | AC | 951 ms | 42880 KB |
test_48.txt | AC | 949 ms | 42688 KB |
test_49.txt | AC | 992 ms | 42708 KB |
test_50.txt | AC | 1029 ms | 42760 KB |
test_51.txt | AC | 955 ms | 42820 KB |
test_52.txt | AC | 953 ms | 42756 KB |
test_53.txt | AC | 955 ms | 42844 KB |
test_54.txt | AC | 941 ms | 42740 KB |
test_55.txt | AC | 965 ms | 42760 KB |
test_56.txt | AC | 949 ms | 42768 KB |
test_57.txt | AC | 957 ms | 42832 KB |
test_58.txt | AC | 954 ms | 42752 KB |