結果
問題 | No.523 LED |
ユーザー | はまやんはまやん |
提出日時 | 2017-06-02 22:30:18 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 410 ms / 2,000 ms |
コード長 | 3,296 bytes |
コンパイル時間 | 15,901 ms |
コンパイル使用メモリ | 446,300 KB |
実行使用メモリ | 49,700 KB |
最終ジャッジ日時 | 2024-11-20 09:14:44 |
合計ジャッジ時間 | 24,636 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 291 ms
49,532 KB |
testcase_01 | AC | 292 ms
49,536 KB |
testcase_02 | AC | 303 ms
49,608 KB |
testcase_03 | AC | 299 ms
49,448 KB |
testcase_04 | AC | 297 ms
49,456 KB |
testcase_05 | AC | 401 ms
49,616 KB |
testcase_06 | AC | 289 ms
49,592 KB |
testcase_07 | AC | 296 ms
49,576 KB |
testcase_08 | AC | 291 ms
49,460 KB |
testcase_09 | AC | 298 ms
49,628 KB |
testcase_10 | AC | 294 ms
49,408 KB |
testcase_11 | AC | 293 ms
49,588 KB |
testcase_12 | AC | 298 ms
49,532 KB |
testcase_13 | AC | 319 ms
49,608 KB |
testcase_14 | AC | 294 ms
49,464 KB |
testcase_15 | AC | 297 ms
49,688 KB |
testcase_16 | AC | 295 ms
49,452 KB |
testcase_17 | AC | 294 ms
49,536 KB |
testcase_18 | AC | 410 ms
49,608 KB |
testcase_19 | AC | 339 ms
49,560 KB |
testcase_20 | AC | 333 ms
49,532 KB |
testcase_21 | AC | 383 ms
49,556 KB |
testcase_22 | AC | 390 ms
49,700 KB |
testcase_23 | AC | 392 ms
49,564 KB |
testcase_24 | AC | 299 ms
49,596 KB |
コンパイルメッセージ
Main.kt:13:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^ Main.kt:89:22: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. if (b == '-'.toInt()) { ^ Main.kt:93:21: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. if (b < '0'.toInt() || '9'.toInt() < b) { ^ Main.kt:93:36: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. if (b < '0'.toInt() || '9'.toInt() < b) { ^ Main.kt:97:21: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. if ('0'.toInt() <= b && b <= '9'.toInt()) { ^ Main.kt:97:46: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. if ('0'.toInt() <= b && b <= '9'.toInt()) { ^ Main.kt:99:31: warning: 'toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead. n += (b - '0'.toInt()).toLong() ^
ソースコード
import java.util.* import java.util.NoSuchElementException import java.io.IOException import java.util.PriorityQueue import java.util.Arrays import java.util.ArrayList var sc : FastScanner = FastScanner() val mod = 1000000007L fun main(args: Array<String>) { var N = sc.nextInt() var ans = 1L for(i in 1..N) { var a = (i * 2 - 1).toLong() var b = i.toLong() ans = (((ans.toLong() * a) % mod) * b) % mod } println(ans) } class FastScanner { private val `in` = System.`in` private val buffer = ByteArray(1024) private var ptr = 0 private var bufferLength = 0 private fun hasNextByte(): Boolean { if (ptr < bufferLength) { return true } else { ptr = 0 try { bufferLength = `in`.read(buffer) } catch (e: IOException) { e.printStackTrace() } if (bufferLength <= 0) { return false } } return true } private fun readByte(): Int { if (hasNextByte()) return buffer[ptr++].toInt() else return -1 } private fun isPrintableChar(c: Int): Boolean { return 33 <= c && c <= 126 } private fun skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr].toInt())) ptr++ } internal operator fun hasNext(): Boolean { skipUnprintable() return hasNextByte() } operator fun next(): String { if (!hasNext()) throw NoSuchElementException() val sb = StringBuilder() var b = readByte() while (isPrintableChar(b)) { sb.appendCodePoint(b) b = readByte() } return sb.toString() } internal fun nextLong(): Long { if (!hasNext()) throw NoSuchElementException() var n: Long = 0 var minus = false var b = readByte() if (b == '-'.toInt()) { minus = true b = readByte() } if (b < '0'.toInt() || '9'.toInt() < b) { throw NumberFormatException() } while (true) { if ('0'.toInt() <= b && b <= '9'.toInt()) { n *= 10 n += (b - '0'.toInt()).toLong() } else if (b == -1 || !isPrintableChar(b)) { return if (minus) -n else n } else { throw NumberFormatException() } b = readByte() } } internal fun nextDouble(): Double { return java.lang.Double.parseDouble(next()) } internal fun nextDoubleArray(n: Int): DoubleArray { val array = DoubleArray(n) for (i in 0..n - 1) { array[i] = nextDouble() } return array } internal fun nextDoubleMap(n: Int, m: Int): Array<DoubleArray?> { val map = arrayOfNulls<DoubleArray?>(n) for (i in 0..n - 1) { map[i] = nextDoubleArray(m) } return map } fun nextInt(): Int { return nextLong().toInt() } fun nextIntArray(n: Int): IntArray { val array = IntArray(n) for (i in 0..n - 1) { array[i] = nextInt() } return array } }