結果

問題 No.1010 折って重ねて
ユーザー mikhailmikhail
提出日時 2020-03-20 21:57:04
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 342 ms / 2,000 ms
コード長 2,905 bytes
コンパイル時間 20,563 ms
コンパイル使用メモリ 464,580 KB
実行使用メモリ 55,244 KB
最終ジャッジ日時 2024-05-08 21:54:06
合計ジャッジ時間 34,108 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 342 ms
55,052 KB
testcase_01 AC 333 ms
55,140 KB
testcase_02 AC 329 ms
55,056 KB
testcase_03 AC 329 ms
54,836 KB
testcase_04 AC 334 ms
55,144 KB
testcase_05 AC 332 ms
55,108 KB
testcase_06 AC 331 ms
54,840 KB
testcase_07 AC 327 ms
55,144 KB
testcase_08 AC 336 ms
54,868 KB
testcase_09 AC 335 ms
55,104 KB
testcase_10 AC 331 ms
55,132 KB
testcase_11 AC 335 ms
55,152 KB
testcase_12 AC 339 ms
55,032 KB
testcase_13 AC 337 ms
55,036 KB
testcase_14 AC 330 ms
55,036 KB
testcase_15 AC 328 ms
55,036 KB
testcase_16 AC 327 ms
55,140 KB
testcase_17 AC 328 ms
54,768 KB
testcase_18 AC 329 ms
54,880 KB
testcase_19 AC 333 ms
54,944 KB
testcase_20 AC 336 ms
55,032 KB
testcase_21 AC 329 ms
54,868 KB
testcase_22 AC 334 ms
55,064 KB
testcase_23 AC 330 ms
55,072 KB
testcase_24 AC 334 ms
55,244 KB
testcase_25 AC 336 ms
55,216 KB
testcase_26 AC 329 ms
55,072 KB
testcase_27 AC 330 ms
55,148 KB
testcase_28 AC 335 ms
55,092 KB
testcase_29 AC 332 ms
54,940 KB
testcase_30 AC 333 ms
55,168 KB
testcase_31 AC 331 ms
54,960 KB
testcase_32 AC 330 ms
55,028 KB
testcase_33 AC 334 ms
54,896 KB
testcase_34 AC 334 ms
54,872 KB
testcase_35 AC 337 ms
55,072 KB
testcase_36 AC 334 ms
54,920 KB
testcase_37 AC 333 ms
55,112 KB
testcase_38 AC 333 ms
55,012 KB
testcase_39 AC 332 ms
54,968 KB
testcase_40 AC 333 ms
55,116 KB
testcase_41 AC 332 ms
54,912 KB
testcase_42 AC 329 ms
55,148 KB
testcase_43 AC 332 ms
54,872 KB
testcase_44 AC 342 ms
54,968 KB
testcase_45 AC 338 ms
55,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:9:10: warning: parameter 'args' is never used
fun main(args: Array<String>){
         ^
Main.kt:61:129: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Long
fun max(a: Long = -LINF, b: Long = -LINF, c: Long = -LINF, d: Long = -LINF, e: Long = -LINF): Long = listOf(a, b, c, d, e).max()!!.toLong()
                                                                                                                                ^
Main.kt:62:124: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Long
fun min(a: Long = LINF, b: Long = LINF, c: Long = LINF, d: Long = LINF, e: Long = LINF): Long = listOf(a, b, c, d, e).min()!!.toLong()
                                                                                                                           ^

ソースコード

diff #

import java.util.*
import java.io.PrintWriter

val pw = PrintWriter(System.out)
val MOD = 1000000007L
val INF = 2147483647
val LINF = 9223372036854775807L

fun main(args: Array<String>){
    solve()
    pw.flush()    
}

fun solve(){
    var (x, y, h) = nextLongList()
    x *= 1000
    y *= 1000
    var a = min(x, y).toDouble()
    var b = max(x, y).toDouble()
    var c = h.toDouble()
    var ans = 0
    while(a > c){
        a /= 2.0
        c *= 2
        ans++
    }
    while(b > c){
        b /= 2.0
        c *= 2
        ans++
    }
    println(ans)

}


// Print
fun println(v: String){
    pw.println(v)
}
fun print(v: String){
    pw.print(v)
}

// Read
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map{ it.toInt() }
fun nextLongList() = next().split(" ").map{ it.toLong() }
fun nextDoubleList() = next().split(" ").map{ it.toDouble() }
fun nextAryln(n: Int) = Array(n){ next() }
fun nextIntAryln(n: Int) = IntArray(n){ nextInt() }
fun nextLongAryln(n: Int) = LongArray(n){ nextLong() }
fun nextDoubleAryln(n: Int) = DoubleArray(n) { nextDouble() }

// Math
fun abs(n: Long) : Long = Math.abs(n)
fun max(a: Long = -LINF, b: Long = -LINF, c: Long = -LINF, d: Long = -LINF, e: Long = -LINF): Long = listOf(a, b, c, d, e).max()!!.toLong()
fun min(a: Long = LINF, b: Long = LINF, c: Long = LINF, d: Long = LINF, e: Long = LINF): Long = listOf(a, b, c, d, e).min()!!.toLong()
fun prime(from: Long, to: Long = from) : List<Long>{
    return (from..to).filter{ i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all{ j -> i % j != 0L}
    }
}
fun gcd(a: Long, b: Long) : Long = if(a % b == 0L) b else gcd(b, (a % b))
fun lcm(a: Long, b: Long) : Long = a / gcd(a, b) * b
fun modpow(a: Long, n: Long, p:Long = MOD) : Long {
    var res = 1L
    var ar = a
    var nr = n
    while(nr > 0){
        if((nr and 1) == 1L) res = res * ar % p
        ar = ar * ar % p
        nr = nr shr 1
    }
    return res
}
fun modinv(a: Long, p: Long = MOD) : Long = modpow(a, p - 2, p)
fun ncr(n: Long, r: Long) : Long {
    var a = 1L
    var b = 1L
    for (i in 1..r) {
        a = a * (n + 1 - i) % MOD
        b = b * i % MOD
    }
    return modinv(b, MOD) * a % MOD
}

class Combination(val max: Int){
    val fac = LongArray(max)
    val finv = LongArray(max)
    val inv = LongArray(max)
    val p = MOD.toInt()
    fun init(){
        fac[0] = 1
        fac[1] = 1
        finv[0] = 1
        finv[1] = 1
        inv[1] = 1
        for (i in 2 until max) {
            fac[i] = fac[i - 1] * i % p
            inv[i] = p - inv[p % i] * (p / i) % p;
            finv[i] = finv[i - 1] * inv[i] % p
        }
    }
    fun com(n: Int, r: Int) : Long = if(n < r || (n < 0 || r < 0)) 0 else fac[n] * (finv[r] * finv[n - r] % p) % p
}
0