結果

問題 No.480 合計
ユーザー makotonari
提出日時 2017-10-21 15:27:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 09:49:45
合計ジャッジ時間 922 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d", &input);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

#define DEF_INPUT_MIN (1)
#define DEF_INPUT_MAX (100)

int main(void) {
    int itr = 0;
    int input = 0;
    int output = 0;

    while(1) {
        scanf("%d", &input);
        if(input < DEF_INPUT_MIN || input > DEF_INPUT_MAX) {
            continue;
        }
        
        for (itr = 0; itr <= input ; itr++) {
            output += itr;
        }
        printf("%d\n", output);
        break;
    }
    return 0;
}
0