結果
問題 | No.852 連続部分文字列 |
ユーザー | pekempey |
提出日時 | 2019-07-27 03:27:30 |
言語 | Kotlin (1.9.23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,038 bytes |
コンパイル時間 | 12,353 ms |
コンパイル使用メモリ | 443,248 KB |
実行使用メモリ | 179,184 KB |
最終ジャッジ日時 | 2024-11-20 19:08:51 |
合計ジャッジ時間 | 73,517 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 288 ms
58,044 KB |
testcase_01 | AC | 290 ms
90,148 KB |
testcase_02 | AC | 289 ms
67,268 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | WA | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | TLE | - |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
testcase_36 | TLE | - |
testcase_37 | TLE | - |
testcase_38 | TLE | - |
testcase_39 | TLE | - |
testcase_40 | TLE | - |
testcase_41 | TLE | - |
testcase_42 | TLE | - |
testcase_43 | TLE | - |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^ Main.kt:41:16: warning: 'toByte(): Byte' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. while ('0'.toByte() > peek()) next() ^ Main.kt:42:16: warning: 'toByte(): Byte' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. while ('0'.toByte() <= peek()) { ^ Main.kt:43:21: warning: 'toChar(): Char' is deprecated. Direct conversion to Char is deprecated. Use toInt().toChar() or Char constructor instead. ans += peek().toChar() ^ Main.kt:51:16: warning: 'toByte(): Byte' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. while ('0'.toByte() > peek()) next() ^ Main.kt:52:16: warning: 'toByte(): Byte' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. while ('0'.toByte() <= peek()) { ^ Main.kt:53:38: warning: 'toLong(): Long' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. ans = ans * 10 + (peek() - '0'.toLong()) ^
ソースコード
fun main(args: Array<String>) { val rd = Reader() val S = rd.string() val N = S.length val mae = IntArray(26, {-1}) var kotae = 0L for (i in 0..N-1) { kotae += (i - mae[i]).toLong() * (N - i) mae[S[i] - 'a'] = i } println(2.0 * kotae / N / (N + 1)) } class Reader { var buf: ByteArray = ByteArray(5000000) var k: Int = 0 var n: Int = 0 init { check() } private fun check() { if (k == n) { n = System.`in`.read(buf) k = 0 } } private fun peek(): Byte { return buf[k] } private fun next() { k++ check() } fun string(): String { var ans = "" while ('0'.toByte() > peek()) next() while ('0'.toByte() <= peek()) { ans += peek().toChar() next() } return ans } fun long(): Long { var ans: Long = 0 while ('0'.toByte() > peek()) next() while ('0'.toByte() <= peek()) { ans = ans * 10 + (peek() - '0'.toLong()) next() } return ans } fun int(): Int { return long().toInt() } }