結果

問題 No.2681 ゲームセンターの両替
ユーザー ks2mks2m
提出日時 2024-03-20 21:18:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 2,597 ms
コンパイル使用メモリ 74,564 KB
実行使用メモリ 54,476 KB
最終ジャッジ日時 2024-04-15 10:11:59
合計ジャッジ時間 8,003 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
54,224 KB
testcase_01 AC 154 ms
54,212 KB
testcase_02 AC 153 ms
53,832 KB
testcase_03 AC 156 ms
54,048 KB
testcase_04 AC 154 ms
54,456 KB
testcase_05 AC 154 ms
54,100 KB
testcase_06 AC 156 ms
54,380 KB
testcase_07 AC 153 ms
53,840 KB
testcase_08 AC 153 ms
53,960 KB
testcase_09 AC 153 ms
54,276 KB
testcase_10 AC 152 ms
54,224 KB
testcase_11 AC 153 ms
54,476 KB
testcase_12 AC 152 ms
54,152 KB
testcase_13 AC 153 ms
54,396 KB
testcase_14 AC 150 ms
54,128 KB
testcase_15 AC 154 ms
54,268 KB
testcase_16 AC 152 ms
54,404 KB
testcase_17 AC 153 ms
54,424 KB
testcase_18 AC 158 ms
53,828 KB
testcase_19 AC 157 ms
54,100 KB
testcase_20 AC 154 ms
54,408 KB
testcase_21 AC 151 ms
54,056 KB
testcase_22 AC 153 ms
54,208 KB
testcase_23 AC 150 ms
54,228 KB
testcase_24 AC 153 ms
54,136 KB
testcase_25 AC 151 ms
54,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int c = sc.nextInt();
		int y = sc.nextInt();
		sc.close();

		int a = y / 100;
		if (a < c) {
			System.out.println("can't exchange");
			return;
		}

		int b = a % 5;
		if (c <= b) {
			System.out.println("no exchange");
			return;
		}

		for (int x = c; ; x++) {
			if (x % 5 == b) {
				System.out.println(x);
				return;
			}
		}
	}
}
0