結果
問題 |
No.2752 文字列の数え上げ mod 998244353
|
ユーザー |
![]() |
提出日時 | 2024-05-11 05:47:54 |
言語 | Kotlin (2.1.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 635 bytes |
コンパイル時間 | 12,245 ms |
コンパイル使用メモリ | 430,160 KB |
実行使用メモリ | 54,296 KB |
最終ジャッジ日時 | 2024-12-20 08:17:02 |
合計ジャッジ時間 | 21,190 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 RE * 11 |
コンパイルメッセージ
Main.kt:7:18: warning: variable 'ANS' initializer is redundant var ANS =1L; ^
ソースコード
fun main() { val t = readLine()!!.toInt() val mod = 998244353; repeat(t) { val N = readLine()!!.toInt() var ANS =1L; ANS=26*(26.toLong().modPow(N.toLong(),mod.toLong())-1)%mod * 25.toLong().modPow(mod.toLong()-2,mod.toLong())%mod println(ANS) } } private fun Long.modPow(exponent: Long, modulus: Long): Long { var result = 1L var exp = exponent var base = this % modulus while (exp > 0) { if (exp and 1 == 1L) { result = (result * base) % modulus } base = (base * base) % modulus exp = exp shr 1 } return result }