結果

問題 No.115 遠足のおやつ
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-27 07:50:13
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 644 bytes
コンパイル時間 3,552 ms
コンパイル使用メモリ 77,212 KB
実行使用メモリ 41,764 KB
最終ジャッジ日時 2024-04-25 06:59:36
合計ジャッジ時間 10,818 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 132 ms
41,120 KB
testcase_02 AC 147 ms
41,320 KB
testcase_03 AC 127 ms
41,044 KB
testcase_04 AC 146 ms
41,504 KB
testcase_05 AC 148 ms
41,428 KB
testcase_06 AC 128 ms
40,952 KB
testcase_07 AC 148 ms
41,220 KB
testcase_08 AC 135 ms
41,268 KB
testcase_09 AC 130 ms
41,128 KB
testcase_10 AC 127 ms
41,312 KB
testcase_11 AC 128 ms
40,964 KB
testcase_12 AC 129 ms
41,088 KB
testcase_13 AC 129 ms
41,140 KB
testcase_14 AC 131 ms
40,576 KB
testcase_15 AC 148 ms
41,228 KB
testcase_16 AC 145 ms
41,428 KB
testcase_17 AC 134 ms
40,348 KB
testcase_18 AC 135 ms
41,344 KB
testcase_19 AC 144 ms
41,452 KB
testcase_20 AC 144 ms
41,544 KB
testcase_21 AC 126 ms
41,100 KB
testcase_22 AC 142 ms
41,584 KB
testcase_23 AC 118 ms
40,436 KB
testcase_24 AC 148 ms
41,416 KB
testcase_25 AC 146 ms
41,448 KB
testcase_26 AC 148 ms
41,312 KB
testcase_27 AC 143 ms
41,452 KB
testcase_28 AC 146 ms
41,344 KB
testcase_29 AC 144 ms
41,544 KB
testcase_30 AC 145 ms
41,272 KB
testcase_31 AC 131 ms
40,456 KB
testcase_32 AC 137 ms
40,508 KB
testcase_33 AC 129 ms
40,360 KB
testcase_34 AC 147 ms
41,764 KB
testcase_35 AC 145 ms
41,344 KB
testcase_36 AC 146 ms
41,344 KB
testcase_37 AC 146 ms
41,340 KB
testcase_38 AC 146 ms
41,352 KB
testcase_39 AC 130 ms
40,940 KB
testcase_40 AC 130 ms
41,440 KB
testcase_41 AC 126 ms
41,148 KB
testcase_42 AC 142 ms
41,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise132{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int d = sc.nextInt();
    int k = sc.nextInt();

    int[] a = new int[101];

    for(int i = 1; i <= k; i++){
      a[i] = i;
      d -= i;
    }

    for(int i = k; d > 0 && i > 0; i--){
      int b = Math.min(d, n - k);
      a[i] += b;
      d -= b;
    }
    if (d != 0){
      System.out.println(-1);
      return;
    }
    for(int i = 1; i <= k; i++){
      if(i == k){
        System.out.println(a[i]);
      }else{
        System.out.print(a[i] + " ");
      }
    }
	}
}
0