結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー Cassian Russell-Hart
提出日時 2025-09-15 17:30:15
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 224 bytes
コンパイル時間 1,177 ms
コンパイル使用メモリ 26,668 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-15 17:30:19
合計ジャッジ時間 2,694 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 11 RE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:13: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
    5 |     scanf("%d", &N);
      |            ~^   ~~
      |             |   |
      |             |   long long int *
      |             int *
      |            %lld
main.c:13:16: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   13 |     printf("%11d\n", sum);
      |             ~~~^     ~~~
      |                |     |
      |                int   long long int
      |             %11lld
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d", &N);
      |     ^~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d",&data[N]);
      |         ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void) {
    long long int N, sum;
    scanf("%d", &N);

    int data[N];

    for(int i = 0; i < N; i++) {
	scanf("%d",&data[N]);
	sum +=data[i];
    }
    printf("%11d\n", sum);
    return 0;
}
0