結果

問題 No.1010 折って重ねて
ユーザー mikhailmikhail
提出日時 2020-03-20 21:26:06
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 2,310 bytes
コンパイル時間 15,249 ms
コンパイル使用メモリ 460,560 KB
実行使用メモリ 52,028 KB
最終ジャッジ日時 2024-05-08 20:29:56
合計ジャッジ時間 30,845 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 294 ms
51,772 KB
testcase_01 AC 298 ms
51,764 KB
testcase_02 AC 293 ms
51,624 KB
testcase_03 AC 300 ms
51,716 KB
testcase_04 AC 297 ms
51,724 KB
testcase_05 AC 297 ms
51,880 KB
testcase_06 AC 300 ms
51,888 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 298 ms
51,892 KB
testcase_11 AC 302 ms
51,964 KB
testcase_12 WA -
testcase_13 AC 295 ms
51,632 KB
testcase_14 AC 293 ms
51,996 KB
testcase_15 AC 294 ms
51,788 KB
testcase_16 AC 290 ms
51,724 KB
testcase_17 AC 293 ms
51,872 KB
testcase_18 AC 292 ms
51,724 KB
testcase_19 WA -
testcase_20 AC 296 ms
51,808 KB
testcase_21 AC 294 ms
51,960 KB
testcase_22 WA -
testcase_23 AC 287 ms
51,908 KB
testcase_24 AC 290 ms
51,772 KB
testcase_25 AC 303 ms
51,924 KB
testcase_26 WA -
testcase_27 AC 336 ms
51,852 KB
testcase_28 AC 300 ms
51,932 KB
testcase_29 AC 295 ms
51,712 KB
testcase_30 AC 296 ms
51,664 KB
testcase_31 AC 295 ms
51,752 KB
testcase_32 WA -
testcase_33 AC 291 ms
51,904 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 289 ms
51,592 KB
testcase_37 AC 290 ms
51,892 KB
testcase_38 WA -
testcase_39 AC 290 ms
51,648 KB
testcase_40 WA -
testcase_41 AC 299 ms
51,744 KB
testcase_42 AC 298 ms
51,868 KB
testcase_43 AC 298 ms
51,656 KB
testcase_44 AC 291 ms
52,000 KB
testcase_45 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:9:10: warning: parameter 'args' is never used
fun main(args: Array<String>){
         ^
Main.kt:59: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:60: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) = nextDoubleList()
    x *= 1000.0
    y *= 1000.0
    var ans = 0
    while(x  > h || y  > h){
        if(x > h){
            x /= 2
        } else if(y > h){
            y /= 2
        } else {
            break
        }
        ans++
        h *= 2
    }
    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
}
0