restructure zeta/** to storage/zeta/**

This commit is contained in:
2025-05-10 21:54:24 +09:00
parent 2886820691
commit 2f2e0759fd
407 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
import kotlin.math.*
class NarockSolver(val s: String) {
companion object {
val HAXIM: Int = 1000000007
}
fun solve(): Int {
var cntR = 0
var cntO = 0
var cntC = 0
var cntS = 0
var rfront = 1
for (v: Char in s) {
if (v == 'R') {
cntR += rfront
cntR %= HAXIM
} else if (v == 'O') {
cntO += cntR
cntO %= HAXIM
} else if (v == 'C') {
cntC += cntO
cntC %= HAXIM
} else if (v == 'K') {
cntS += cntC
cntS %= HAXIM
}
rfront *= 2
rfront %= HAXIM
}
return cntS
}
}
fun main() {
readLine()
val s: String = readLine()!!
val solver = NarockSolver(s)
println(solver.solve())
}