結果

問題 No.480 合計
ユーザー hitoshinnct
提出日時 2022-12-12 17:08:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 164 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 65,688 KB
最終ジャッジ日時 2025-02-09 10:18:13
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:9: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
    8 |     ans = ans + n;
      |     ~~~~^~~~~~~~~
main.cpp:5:9: note: ‘ans’ was declared here
    5 |   int N,ans;
      |         ^~~

ソースコード

diff #

#include <iostream>
using namespace std;

int main () {
  int N,ans;
  cin >> N;
  for (int n = 0;n < N;n ++) {
    ans = ans + n;
  }
  cout << ans ;
  return 0;
}
0