結果

問題 No.115 遠足のおやつ
ユーザー fal_rndfal_rnd
提出日時 2017-01-20 22:51:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 542 bytes
コンパイル時間 3,156 ms
コンパイル使用メモリ 72,780 KB
実行使用メモリ 58,048 KB
最終ジャッジ日時 2023-08-24 18:21:57
合計ジャッジ時間 10,942 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 121 ms
53,628 KB
testcase_03 WA -
testcase_04 AC 122 ms
55,588 KB
testcase_05 AC 121 ms
55,796 KB
testcase_06 AC 120 ms
56,184 KB
testcase_07 AC 121 ms
56,204 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 122 ms
55,704 KB
testcase_14 AC 123 ms
55,764 KB
testcase_15 AC 122 ms
56,260 KB
testcase_16 AC 120 ms
55,824 KB
testcase_17 AC 122 ms
55,720 KB
testcase_18 AC 120 ms
56,228 KB
testcase_19 AC 121 ms
55,432 KB
testcase_20 AC 122 ms
56,152 KB
testcase_21 AC 120 ms
55,456 KB
testcase_22 AC 121 ms
55,900 KB
testcase_23 WA -
testcase_24 AC 121 ms
55,664 KB
testcase_25 AC 123 ms
55,980 KB
testcase_26 AC 123 ms
56,080 KB
testcase_27 AC 122 ms
55,460 KB
testcase_28 AC 122 ms
55,348 KB
testcase_29 AC 121 ms
56,196 KB
testcase_30 AC 120 ms
55,756 KB
testcase_31 AC 121 ms
55,896 KB
testcase_32 AC 122 ms
55,948 KB
testcase_33 AC 123 ms
55,600 KB
testcase_34 AC 123 ms
55,884 KB
testcase_35 AC 123 ms
55,664 KB
testcase_36 AC 124 ms
55,768 KB
testcase_37 AC 122 ms
56,104 KB
testcase_38 AC 123 ms
56,092 KB
testcase_39 WA -
testcase_40 AC 121 ms
55,956 KB
testcase_41 AC 121 ms
58,048 KB
testcase_42 AC 122 ms
55,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package src;

import java.util.*;
public class A{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int sum=0,n=s.nextInt(),d=s.nextInt(),k=s.nextInt();
		int[] r=new int[k];
		for(int i=0;i<k;i++) {
			sum+=i+1;
			r[i]=i+1;
		}
		if(sum>d) {
			System.out.println(-1);
			return;
		}
		for(int i=0;i<k;i++) {
			sum-=r[r.length-1-i];
			r[r.length-1-i]=Math.min(d-sum, n-i);
			sum+=Math.min(d-sum, n-i);
		}
		System.out.println(Arrays.toString(r).replaceAll("[^0-9,]", "").replaceAll(",", " "));
	}
}
0