結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー 826814741_6826814741_6
提出日時 2019-01-10 18:52:28
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 301 ms / 1,000 ms
コード長 389 bytes
コンパイル時間 12,552 ms
コンパイル使用メモリ 423,536 KB
実行使用メモリ 54,692 KB
最終ジャッジ日時 2023-08-13 01:17:00
合計ジャッジ時間 25,633 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 301 ms
52,876 KB
testcase_01 AC 301 ms
52,916 KB
testcase_02 AC 300 ms
52,924 KB
testcase_03 AC 299 ms
52,864 KB
testcase_04 AC 297 ms
52,728 KB
testcase_05 AC 291 ms
52,692 KB
testcase_06 AC 295 ms
52,820 KB
testcase_07 AC 298 ms
52,828 KB
testcase_08 AC 296 ms
52,796 KB
testcase_09 AC 298 ms
52,684 KB
testcase_10 AC 291 ms
52,780 KB
testcase_11 AC 297 ms
52,868 KB
testcase_12 AC 297 ms
52,800 KB
testcase_13 AC 296 ms
52,664 KB
testcase_14 AC 291 ms
52,756 KB
testcase_15 AC 295 ms
52,764 KB
testcase_16 AC 294 ms
52,676 KB
testcase_17 AC 298 ms
52,684 KB
testcase_18 AC 296 ms
52,660 KB
testcase_19 AC 297 ms
53,076 KB
testcase_20 AC 295 ms
52,812 KB
testcase_21 AC 295 ms
54,692 KB
testcase_22 AC 295 ms
52,796 KB
testcase_23 AC 288 ms
52,864 KB
testcase_24 AC 299 ms
52,976 KB
testcase_25 AC 290 ms
52,964 KB
testcase_26 AC 291 ms
52,772 KB
testcase_27 AC 291 ms
52,704 KB
testcase_28 AC 291 ms
52,992 KB
testcase_29 AC 294 ms
52,604 KB
testcase_30 AC 291 ms
52,720 KB
testcase_31 AC 289 ms
52,728 KB
testcase_32 AC 289 ms
52,916 KB
testcase_33 AC 289 ms
52,836 KB
testcase_34 AC 291 ms
52,892 KB
testcase_35 AC 293 ms
52,784 KB
testcase_36 AC 293 ms
52,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

tailrec fun gcd(a: Long, b: Long): Long = if (b!=0L) gcd(b,a%b) else a
fun lcm(a: Long, b: Long): Long = a/gcd(a,b)*b
fun f(n: Long, a: Long, b: Long, c: Long): Long =
    n/a+n/b+n/c-n/lcm(a,b)-n/lcm(b,c)-n/lcm(c,a)+n/lcm(lcm(a,b),c)

fun main(args: Array<String>) {
    val n = readLine()!!.toLong()
    val (a,b,c) = readLine()!!.split(' ').map(String::toLong)
    println(f(n,a,b,c))
}
0