結果

問題 No.542 1円玉と5円玉
ユーザー fjafjafjafjafjafja
提出日時 2017-07-18 17:34:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 3,886 ms
コンパイル使用メモリ 75,672 KB
実行使用メモリ 41,836 KB
最終ジャッジ日時 2024-04-17 01:58:06
合計ジャッジ時間 6,401 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
41,432 KB
testcase_01 AC 138 ms
41,020 KB
testcase_02 AC 137 ms
41,428 KB
testcase_03 AC 136 ms
41,352 KB
testcase_04 AC 135 ms
41,836 KB
testcase_05 AC 156 ms
41,544 KB
testcase_06 AC 160 ms
41,616 KB
testcase_07 AC 165 ms
41,648 KB
testcase_08 AC 161 ms
41,472 KB
testcase_09 AC 161 ms
41,228 KB
testcase_10 AC 144 ms
41,580 KB
testcase_11 AC 146 ms
41,444 KB
testcase_12 AC 179 ms
41,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class N542 {

	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int total=A+B*5;
		int a=0;
		int b=0;
		if(A>4)
		{
			A=4;
		}
		int buf=0;
		ArrayList<Integer> ans=new ArrayList<Integer>();
		while(total>buf)
{
			a++;
			if(a>A)
			{
				a=0;
				b++;
			}

			buf=a+b*5;
			ans.add(buf);

		}
		for(int i=0;i<ans.size();i++)
		{
			System.out.println(ans.get(i));
		}

	}
}
0