結果

問題 No.198 キャンディー・ボックス2
ユーザー memmemmi
提出日時 2018-10-02 14:44:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 1,022 ms
コンパイル使用メモリ 110,596 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 10:03:07
合計ジャッジ時間 1,970 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
#include <array>
#include <numeric>
#include <regex>
#include <bitset>
#include <deque>

using namespace std;
typedef long long ll;
typedef pair<int, int> p_ii;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

int c[15];

int main() {
    int b, n;
    cin>>b>>n;
    for (int i = 0; i < n; i++) {
        cin>>c[i];
    }
    ll ta=0;
    for (int i = 0; i < n; i++) {
        ta+=c[i];
    }
    ta/=n;

    ll res=0;
    for (int i = 0; i < n; i++) {
        res+=(ll)abs(c[i]-ta);
    }

    cout<<res<<endl;

    return 0;
}
0