結果
| 問題 | No.2560 A_1 < A_2 < ... < A_N |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-07 21:41:19 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 189 bytes |
| 記録 | |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 29,384 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-08 16:36:02 |
| 合計ジャッジ時間 | 1,502 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:2:29: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long int *’ [-Wformat=]
2 | main(){long T,N,X,i;scanf("%d",&T);while(T-->0){scanf("%ld%ld",&N,&X);if(N*(N+1)/2>X){puts("-1");continue;}for(i=1;i<=N-1;++i){printf("%ld ",i);X-=i;}printf("%ld\n",X);}}
| ~^ ~~
| | |
| | long int *
| int *
| %ld
main.c:2:21: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
2 | main(){long T,N,X,i;scanf("%d",&T);while(T-->0){scanf("%ld%ld",&N,&X);if(N*(N+1)/2>X){puts("-1");continue;}for(i=1;i<=N-1;++i){printf("%ld ",i);X-=i;}printf("%ld\n",X);}}
| ^~~~~~~~~~~~~~
main.c:2:49: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
2 | main(){long T,N,X,i;scanf("%d",&T);while(T-->0){scanf("%ld%ld",&N,&X);if(N*(N+1)/2>X){puts("-1");continue;}for(i=1;i<=N-1;++i){printf("%ld ",i);X-=i;}printf("%ld\n",X);}}
| ^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
main(){long T,N,X,i;scanf("%d",&T);while(T-->0){scanf("%ld%ld",&N,&X);if(N*(N+1)/2>X){puts("-1");continue;}for(i=1;i<=N-1;++i){printf("%ld ",i);X-=i;}printf("%ld\n",X);}}