結果

問題 No.112 ややこしい鶴亀算
ユーザー f843nmfwisfeuw
提出日時 2020-09-08 20:39:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 729 bytes
コンパイル時間 1,334 ms
コンパイル使用メモリ 96,560 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-30 07:23:40
合計ジャッジ時間 2,003 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
#include <bitset>
#include <cassert>

using namespace std;

int main() {

    int N;
    cin >> N;
    vector<int> as;
    int s = 0;
    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        as.push_back(a);
        s += a;
    }
    s /= (N - 1);


    int t = 0;
    int k = 0;
    for (int i = 0; i < N; ++i) {
        if ((s - as[i]) == 2) {
            t += 1;
        } else {
            assert((s - as[i]) == 4);
            k += 1;
        }
    }
    cout << t << " " << k << endl;
}
0