結果

問題 No.2560 A_1 < A_2 < ... < A_N
ユーザー CloverClover
提出日時 2023-12-07 21:27:03
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 193 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 28,672 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-07 21:27:06
合計ジャッジ時間 1,901 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 15 ms
6,676 KB
testcase_02 AC 17 ms
6,676 KB
testcase_03 AC 14 ms
6,676 KB
testcase_04 AC 18 ms
6,676 KB
testcase_05 AC 19 ms
6,676 KB
testcase_06 AC 31 ms
6,676 KB
testcase_07 AC 30 ms
6,676 KB
testcase_08 AC 31 ms
6,676 KB
testcase_09 AC 31 ms
6,676 KB
testcase_10 AC 31 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){long T,N,X;scanf("%d",&T);while(T-->0){scanf("%ld %ld",&N,&X);if(N*(N+1)/2>X){puts("-1");continue;}for(int i=1;i<=N-1;++i){printf("%ld ",i);X-=i;}printf("%ld\n",X);}}
      | ^~~~

ソースコード

diff #

#include <stdio.h>

main(){long T,N,X;scanf("%d",&T);while(T-->0){scanf("%ld %ld",&N,&X);if(N*(N+1)/2>X){puts("-1");continue;}for(int i=1;i<=N-1;++i){printf("%ld ",i);X-=i;}printf("%ld\n",X);}}
0