結果

問題 No.740 幻の木
ユーザー heyanxxheyanxx
提出日時 2019-07-04 12:07:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 968 bytes
コンパイル時間 4,231 ms
コンパイル使用メモリ 77,556 KB
実行使用メモリ 54,080 KB
最終ジャッジ日時 2023-10-19 07:34:41
合計ジャッジ時間 4,796 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
53,492 KB
testcase_01 AC 56 ms
52,456 KB
testcase_02 AC 56 ms
53,496 KB
testcase_03 AC 55 ms
53,496 KB
testcase_04 AC 56 ms
52,448 KB
testcase_05 AC 55 ms
53,492 KB
testcase_06 AC 69 ms
54,080 KB
testcase_07 AC 54 ms
53,488 KB
testcase_08 AC 56 ms
53,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package test.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Yukicoder740 {

	public static void main(String[] args) {
		try {
			String[]str=input();
			int N =Integer.parseInt(str[0]);
			int M =Integer.parseInt(str[1]);
			int P =Integer.parseInt(str[2]);
			int Q =Integer.parseInt(str[3]);
			int sum=0;
			while(true) {
			for(int i=1;i<=12;i++) {
				//System.out.println(i+sum*12);
				if(i>=P&&i<=P+Q-1) {
					N=N-2*M;
					if(N<=0) {
						System.out.println(i+sum*12);
						return;
					}
				}else {
				N=N-M;
				if(N<=0) {
					System.out.println(i+sum*12);
					return;
				}
			}
		}
				sum++;
		}
			
			
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	public static  String[] input() throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		
		String str=br.readLine();
		String[]str2=str.split(" ");
		
		return str2;
	}
}
0