結果

問題 No.1991 Secret Garden
ユーザー 👑 Nachia
提出日時 2022-06-24 22:52:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 66,380 KB
最終ジャッジ日時 2025-01-30 00:29:22
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>


using namespace std;
using i64 = int64_t;

int main(){
    i64 N; cin >> N;
    auto countShade = [N](i64 showCnt) -> bool {
        i64 height = N - showCnt;
        height -= (N - 1 - height) * 2;
        for(i64 baseHeight = N; baseHeight >= N-showCnt+3; baseHeight--){
            if(height <= 0) return true;
            height -= (baseHeight - 3 - height) * 2 + 3;
        }
        return height <= 0;
    };

    i64 c = 1;
    while(!countShade(c)) c++;
    cout << (N-c) << '\n';

    return 0;
}
0