結果

問題 No.77 レンガのピラミッド
ユーザー youjo_yamiotiyoujo_yamioti
提出日時 2018-12-07 05:26:10
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 493 bytes
コンパイル時間 1,235 ms
コンパイル使用メモリ 144,864 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 03:31:34
合計ジャッジ時間 4,007 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 RE -
testcase_07 AC 1 ms
4,348 KB
testcase_08 RE -
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 1 ms
4,356 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 RE -
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 1 ms
4,352 KB
testcase_23 AC 1 ms
4,348 KB
testcase_24 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int k = 0;
    vector<int> B(101,0);
    int blocksum = 0;
    for(int i=1;i<=N;i++){
        cin >> B[i];
        blocksum += B[i];
    }
    while((k+1)*(k+1)<=blocksum) k++;
    int ans=0;
    vector<int> P(101,0);
    for(int i=1;i<=k;i++){
        P[i] = i;
        P[2*k-i] = i;
    }
    for(int i=1;i<=N;i++){
        if(B[i]>P[i]) ans += B[i] - P[i];
    }
    cout << ans << endl;
    return 0;
}
0