結果

問題 No.156 キャンディー・ボックス
ユーザー Mcpu3Mcpu3
提出日時 2018-06-22 00:17:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 3,189 ms
コンパイル使用メモリ 72,324 KB
実行使用メモリ 56,060 KB
最終ジャッジ日時 2023-09-19 03:43:54
合計ジャッジ時間 9,232 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,296 KB
testcase_01 AC 128 ms
55,836 KB
testcase_02 AC 127 ms
55,304 KB
testcase_03 AC 126 ms
55,700 KB
testcase_04 AC 126 ms
53,532 KB
testcase_05 AC 135 ms
55,692 KB
testcase_06 AC 135 ms
55,852 KB
testcase_07 AC 137 ms
55,936 KB
testcase_08 AC 142 ms
55,720 KB
testcase_09 AC 135 ms
55,300 KB
testcase_10 AC 135 ms
55,548 KB
testcase_11 AC 139 ms
55,792 KB
testcase_12 AC 136 ms
55,924 KB
testcase_13 AC 140 ms
55,580 KB
testcase_14 AC 136 ms
55,528 KB
testcase_15 AC 134 ms
55,500 KB
testcase_16 AC 135 ms
55,688 KB
testcase_17 AC 135 ms
55,628 KB
testcase_18 AC 136 ms
56,060 KB
testcase_19 AC 137 ms
55,428 KB
testcase_20 AC 129 ms
55,680 KB
testcase_21 AC 129 ms
55,456 KB
testcase_22 AC 136 ms
55,516 KB
testcase_23 AC 128 ms
55,448 KB
testcase_24 AC 128 ms
55,448 KB
testcase_25 AC 127 ms
55,664 KB
testcase_26 AC 126 ms
55,440 KB
testcase_27 AC 125 ms
55,732 KB
testcase_28 AC 125 ms
55,660 KB
testcase_29 AC 127 ms
55,460 KB
testcase_30 AC 136 ms
55,664 KB
testcase_31 AC 141 ms
55,460 KB
testcase_32 AC 148 ms
55,708 KB
testcase_33 AC 147 ms
55,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class no156{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int n,m,i,j,t,c[]=new int[10];
		n=stdIn.nextInt();
		m=stdIn.nextInt();
		for(i=0;i<n;i++) c[i]=stdIn.nextInt();
		for(i=0;i<n-1;i++) {
			for(j=n-1;j>i;j--) {
				if(c[j-1]>c[j]) {
					t=c[j-1];
					c[j-1]=c[j];
					c[j]=t;
				}
			}
		}
		for(i=0;m>0;i++) {
			while(c[i]>0&&m>0) {
				m--;
				c[i]--;
			}
		}
		if(c[i-1]>0) System.out.print(i-1);
		else System.out.print(i);
	}
}
0