結果

問題 No.1406 Test
コンテスト
ユーザー akakimidori
提出日時 2021-02-22 18:44:21
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 802 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,163 ms
コンパイル使用メモリ 255,160 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-18 05:53:46
合計ジャッジ時間 8,589 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include "testlib.h"
#include <vector>
#include <iostream>

const int MIN_N = 1;
const int MAX_N = 10LL;

const int MIN_A = 0;
const int MAX_A = 100;

int main(int argc, char** argv) {
    registerValidation(argc, argv);

    const int N = inf.readInt(MIN_N, MAX_N, "N");
    inf.readEoln();
    std::vector<int> A(N - 1);
    for (int i = 0; i + 1 < N; ++i) {
        A[i] = inf.readInt(MIN_A, MAX_A, "A_i");
        if (i + 2 == N) {
            inf.readEoln();
        } else {
            inf.readSpace();
        }
    }
    inf.readEof();

    int ans = 0;
    for (int i = MIN_A; i <= MAX_A; ++i) {
        int sum = i;
        for (int x: A) {
            sum += x;
        }
        if (sum % N == 0) {
            ans += 1;
        }
    }
    std::cout << ans << std::endl;

    return 0;
}
0