結果

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

ソースコード

diff #

#include <stdio.h>

int main(void) {
    long long int N;
    long long int sum = 0;
    scanf("%11d", &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