complete 30917.kt 30924.kt
This commit is contained in:
25
storage/zeta/kt/completed/30917.kt
Normal file
25
storage/zeta/kt/completed/30917.kt
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
fun main() = with(System.`in`.bufferedReader()) {
|
||||||
|
val a: Int = run {
|
||||||
|
for (i in 1 until 10) {
|
||||||
|
println("? A $i")
|
||||||
|
|
||||||
|
if (this.readLine().toInt() == 1) {
|
||||||
|
return@run i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
val b: Int = run {
|
||||||
|
for (i in 1 until 10) {
|
||||||
|
println("? B $i")
|
||||||
|
|
||||||
|
if (this.readLine().toInt() == 1) {
|
||||||
|
return@run i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
println("! ${a + b}")
|
||||||
|
}
|
||||||
24
storage/zeta/kt/completed/30924.kt
Normal file
24
storage/zeta/kt/completed/30924.kt
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
fun main() = with(System.`in`.bufferedReader()) {
|
||||||
|
val a = run {
|
||||||
|
(1..9999).shuffled().forEach {
|
||||||
|
println("? A $it")
|
||||||
|
if (this.readLine().toInt() == 1) {
|
||||||
|
return@run it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
10000
|
||||||
|
}
|
||||||
|
|
||||||
|
val b: Int = run {
|
||||||
|
val cand = (1..10000).shuffled()
|
||||||
|
cand.slice(0 until 9998).forEach {
|
||||||
|
println("? B $it")
|
||||||
|
if (this.readLine().toInt() == 1) {
|
||||||
|
return@run it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cand.last()
|
||||||
|
}
|
||||||
|
|
||||||
|
println("! ${a + b}")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user