結果

問題 No.1406 Test
ユーザー ka_tka_t
提出日時 2021-02-26 21:24:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 1,589 ms
コンパイル使用メモリ 163,680 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 11:54:59
合計ジャッジ時間 2,478 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

#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