結果

問題 No.740 幻の木
ユーザー MaboyMaboy
提出日時 2021-06-22 13:31:19
言語 Swift
(5.10.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 6,194 ms
コンパイル使用メモリ 127,444 KB
実行使用メモリ 8,200 KB
最終ジャッジ日時 2023-09-05 14:24:13
合計ジャッジ時間 5,758 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,168 KB
testcase_01 AC 3 ms
8,104 KB
testcase_02 AC 4 ms
8,116 KB
testcase_03 AC 4 ms
8,132 KB
testcase_04 AC 4 ms
8,124 KB
testcase_05 AC 3 ms
8,116 KB
testcase_06 AC 3 ms
8,200 KB
testcase_07 AC 3 ms
7,976 KB
testcase_08 AC 4 ms
8,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let n = readLine()!.split(separator: " ").map{Int($0)!}
let (N,M,P,Q) = (n[0],n[1],n[2],n[3])
var l = [Int](repeating: M, count: 12)
for i in (P-1)...(P+Q-2){
    l[i] += M
}
let y = l.reduce(0){$0 + $1}
var (m,o) = ((N / y) * 12,N % y)
for i in l{
    if o <= 0{break}
    m += 1
    o -= i
}
print(m)
0