結果

問題 No.63 ポッキーゲーム
ユーザー eagleeagle
提出日時 2022-05-26 15:32:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 353 ms / 5,000 ms
コード長 536 bytes
コンパイル時間 2,017 ms
コンパイル使用メモリ 77,176 KB
実行使用メモリ 57,652 KB
最終ジャッジ日時 2023-10-20 19:28:10
合計ジャッジ時間 6,282 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
57,584 KB
testcase_01 AC 125 ms
57,100 KB
testcase_02 AC 123 ms
57,324 KB
testcase_03 AC 121 ms
57,644 KB
testcase_04 AC 117 ms
57,352 KB
testcase_05 AC 120 ms
57,408 KB
testcase_06 AC 118 ms
57,436 KB
testcase_07 AC 117 ms
57,620 KB
testcase_08 AC 125 ms
57,440 KB
testcase_09 AC 122 ms
57,452 KB
testcase_10 AC 122 ms
57,308 KB
testcase_11 AC 336 ms
56,348 KB
testcase_12 AC 125 ms
57,652 KB
testcase_13 AC 353 ms
57,576 KB
testcase_14 AC 122 ms
57,512 KB
testcase_15 AC 125 ms
57,288 KB
testcase_16 AC 117 ms
57,216 KB
testcase_17 AC 317 ms
57,344 KB
testcase_18 AC 125 ms
57,616 KB
testcase_19 AC 135 ms
56,320 KB
testcase_20 AC 122 ms
57,612 KB
testcase_21 AC 145 ms
57,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//ポッキーの長さ
		int L = sc.nextInt();
		//二人が食べる距離
		int K = sc.nextInt();
		//ユウちゃんが食べるポッキーの長さ
		int ans = 0;
		//ポッキーの残りの長さ
		int pocky = L;
		while(true) {
			if(pocky - K * 2 <= 0) {
				break;
			}
			pocky -= K * 2;
			ans += K;
		}
		System.out.println(ans);
	}
}
0