結果

問題 No.1406 Test
コンテスト
ユーザー ka_t
提出日時 2021-02-26 21:24:29
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 518 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,017 ms
コンパイル使用メモリ 181,208 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-18 23:03:18
合計ジャッジ時間 2,095 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:17:19: warning: 's' may be used uninitialized [-Wmaybe-uninitialized]
   17 |     rep(i, n-1) s += a[i];
main.cpp:16:9: note: 's' was declared here
   16 |     int s;
      |         ^
main.cpp:21:16: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   21 |             ans++;
      |             ~~~^~
main.cpp:18:9: note: 'ans' was declared here
   18 |     int ans;
      |         ^~~

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ll long long
int main(){
    int n;
    cin >> n;
    if (n == 1){
        cout << 100 << endl;
        return 0;
    }
    vector<int> a(n-1);
    rep(i, n-1) cin >> a[i];
    int s;
    rep(i, n-1) s += a[i];
    int ans;
    rep(i, 101){
        if ((s+i)%n == 0){
            ans++;
        }
    }
    cout << ans << endl;
}
0