結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2024-02-01 20:50:50
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 926 bytes
コンパイル時間 2,687 ms
コンパイル使用メモリ 84,592 KB
実行使用メモリ 73,728 KB
最終ジャッジ日時 2024-02-01 20:51:07
合計ジャッジ時間 16,261 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
57,672 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 1,837 ms
73,516 KB
testcase_07 AC 1,931 ms
73,728 KB
testcase_08 AC 1,843 ms
72,884 KB
testcase_09 AC 1,868 ms
73,728 KB
testcase_10 AC 1,846 ms
72,684 KB
testcase_11 AC 227 ms
61,140 KB
testcase_12 AC 221 ms
61,576 KB
testcase_13 AC 223 ms
61,088 KB
testcase_14 AC 204 ms
61,560 KB
testcase_15 AC 241 ms
61,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

    public static void vectorPrint(Vector lis){
        for (int i=0 ; i<lis.size() ; i++){
            System.out.print(lis.get(i));
            if ( i != lis.size()-1){
                System.out.print(' ');
            }else{
                System.out.print('\n');
            }
        }
    }

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        int TT = sc.nextInt();

        for (int lp=0; lp<TT ; lp++){
            int N = sc.nextInt();
            int X = sc.nextInt();
            
            Vector lis = new Vector();
            for (int i=0; i<N-1 ; i++){
                lis.addElement(i+1);
                X -= i+1;
            }
            if (X >= N){
                lis.addElement(X);
                vectorPrint(lis);
            }else{
                System.out.println("-1");
            }
        }
    }
}
0