結果

問題 No.740 幻の木
ユーザー tsunabittsunabit
提出日時 2019-07-03 22:53:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 3,501 ms
コンパイル使用メモリ 75,408 KB
実行使用メモリ 57,584 KB
最終ジャッジ日時 2023-10-17 07:17:03
合計ジャッジ時間 5,553 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
57,504 KB
testcase_01 AC 123 ms
57,456 KB
testcase_02 AC 124 ms
57,584 KB
testcase_03 AC 126 ms
57,504 KB
testcase_04 AC 125 ms
57,508 KB
testcase_05 AC 122 ms
57,152 KB
testcase_06 AC 129 ms
57,268 KB
testcase_07 AC 125 ms
57,384 KB
testcase_08 AC 125 ms
57,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No740 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt(), m = sc.nextInt(), p = sc.nextInt(), q = sc.nextInt(), mo = 1, c = 0;
    	while(n > 0) {
    		c++;
    		n = n - m;
    		if(p <= mo && mo <= p + q - 1) n = n - m;
    		mo = mo < 12? mo + 1 : 1;
    	}
    	System.out.println(c);
    }
}
0