結果

問題 No.740 幻の木
ユーザー maimai
提出日時 2018-10-05 21:28:54
言語 cLay
(20240104-1)
結果
TLE  
実行時間 -
コード長 500 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 159,964 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-19 00:08:30
合計ジャッジ時間 5,707 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// def ascan; gets.split.map(&:to_i); end
// 
// N,M,P,Q = ascan
// 
// n = N
// 
// i = 1
// loop do
//     n -= M
//     n -= M if P-1 <= (i-1)%12 && (i-1)%12 <= P+Q-2
//     if n == 0
//         p i
//         exit
//     end
//     i += 1
// end

ll N,M,P,Q;
{
    int i = 1;
    rd(N,M,P,Q);
    
    while(true){
        N -= M;
        if (P-1 <= (i-1)%12 && (i-1)%12 <= P+Q-2)
            N -= M;
        if (N == 0){
            wt(i);
            return 0;
        }
        i += 1;
    }
}
0