complete 5597.cpp 15552.cpp 26156.kt
This commit is contained in:
19
zeta_cpp/completed/15552.cpp
Normal file
19
zeta_cpp/completed/15552.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
ios_base::sync_with_stdio(0);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
int T;
|
||||||
|
int A, B;
|
||||||
|
std::cin >> T;
|
||||||
|
|
||||||
|
for (int i = 0; i < T; i++) {
|
||||||
|
std::cin >> A >> B;
|
||||||
|
std::cout << A + B << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
zeta_cpp/completed/5597.cpp
Normal file
18
zeta_cpp/completed/5597.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int *arr = new int[30]{0};
|
||||||
|
int index;
|
||||||
|
for (int i = 0; i < 30; i++) {
|
||||||
|
std::cin >> index;
|
||||||
|
arr[index - 1] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 30; i++) {
|
||||||
|
if (!arr[i]) {
|
||||||
|
std::cout << i + 1 << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
40
zeta_kotlin/completed/26156.kt
Normal file
40
zeta_kotlin/completed/26156.kt
Normal 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())
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user