結果
問題 | No.81 すべて足すだけの簡単なお仕事です。 |
ユーザー | javy |
提出日時 | 2015-11-28 06:24:03 |
言語 | Kotlin (1.9.23) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,468 bytes |
コンパイル時間 | 12,077 ms |
コンパイル使用メモリ | 458,816 KB |
実行使用メモリ | 57,992 KB |
最終ジャッジ日時 | 2024-04-30 10:53:38 |
合計ジャッジ時間 | 22,649 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 302 ms
57,596 KB |
testcase_01 | AC | 310 ms
57,748 KB |
testcase_02 | AC | 302 ms
57,756 KB |
testcase_03 | AC | 301 ms
57,868 KB |
testcase_04 | AC | 316 ms
57,908 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 298 ms
57,864 KB |
testcase_11 | AC | 313 ms
57,716 KB |
testcase_12 | AC | 308 ms
57,772 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 312 ms
57,752 KB |
testcase_19 | AC | 302 ms
57,908 KB |
testcase_20 | AC | 303 ms
57,720 KB |
testcase_21 | AC | 305 ms
57,764 KB |
testcase_22 | AC | 319 ms
57,788 KB |
testcase_23 | AC | 317 ms
57,904 KB |
testcase_24 | AC | 308 ms
57,700 KB |
testcase_25 | AC | 303 ms
57,520 KB |
testcase_26 | AC | 302 ms
57,848 KB |
testcase_27 | AC | 302 ms
57,880 KB |
testcase_28 | AC | 299 ms
57,976 KB |
testcase_29 | AC | 310 ms
57,732 KB |
コンパイルメッセージ
Main.kt:8:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^
ソースコード
package Yukicoder import java.math.BigDecimal /** * Created by hichikawa on 2015/11/12. */ fun main(args: Array<String>) { fun readLineLongArray(): List<Long> { val str = readLine() as String val arrStr = str.split(".") val ret = arrStr.map { it.toLong() } return ret } fun readLineLong(): Long { val str = readLine() as String return str.toLong() } fun readLineInt(): Int { val str = readLine() as String return str.toInt() } fun readLineDouble(): Double { val str = readLine() as String return str.toDouble() } fun readLineIntArray() : List<Int> { val str = readLine() as String val arrStr = str.split(" ") val ret = arrStr.map { it.toInt() } return ret } fun readLineDoubleArray(): List<Double> { val str = readLine() as String val arrStr = str.split(".") val ret = arrStr.map { it.toDouble() } return ret } val num = readLineInt() var list = Array(num, {Array<Long>(2, {0})}) for (i in 0..(num-1)) { val str = readLine() as String if (str.indexOf(".") != -1) { val plmi : Int = if (str.get(0) == '-') -1 else 1 val arrStr = str.split(".") val tmp = arrStr.map { it.toLong() } list[i][0] = tmp[0] list[i][1] = tmp[1] * Math.pow(10.toDouble(), (10-arrStr[1].length).toDouble()).toLong() * plmi } else { list[i][0] = str.toLong() } } var ans1 : Long = 0.toLong() var ans2 : Long = 0.toLong() for (item in list) { ans1 += item[0] ans2 += item[1] } // println(ans1) // println(ans2) ans1 += ans2 / 10000000000 ans2 = ans2 % 10000000000 if (ans1 >= 0 && ans2 >= 0) { println(ans1.toString() + "." + java.lang.String.format("%010d",ans2)) } else if (ans1 < 0 && ans2 < 0) { println(ans1.toString() + "." + java.lang.String.format("%010d",ans2*-1)) } else if (ans1 > 0 && ans2 < 0) { println((ans1-1).toString() + "." + java.lang.String.format("%010d",(10000000000-ans2))) } else if (ans1 < 0 && ans2 > 0) { println((ans1+1).toString() + "." + java.lang.String.format("%010d",(10000000000-ans2))) } else if (ans1 == 0.toLong() && ans2 < 0) { println("-" + (ans1).toString() + "." + java.lang.String.format("%010d",(ans2*-1)).toString()) } }