結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー nanatutmc
提出日時 2019-09-12 00:40:14
言語 C11(gcc12 gnu拡張)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=gnu11 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 234 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 91 ms
コンパイル使用メモリ 30,824 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-08 16:20:52
合計ジャッジ時間 1,161 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | main() {
      | ^~~~
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d", &count);
      |     ^~~~~~~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%ld", &num);
      |         ^~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>

main() {
    int count;
    long sum = 0;
    scanf("%d", &count);
    
    for (int i=0; i<count; i++) {
        long num;
        scanf("%ld", &num);
        
        sum += num;
    }
    printf("%ld\n", sum);
}
0