結果

問題 No.853 河原の石
ユーザー trineutron
提出日時 2020-04-14 18:30:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 65,792 KB
最終ジャッジ日時 2025-01-09 18:50:46
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 WA * 46 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

int main() {
    int h, w, step = 1;
    long ans = 0;
    std::cin >> h >> w;
    if (w < 0) w = -w;
    for (int i = 1; i <= h; i++) {
        if (step >= 2 * i) step = 2 * i;
        if (w <= i) {
            ans++;
        } else {
            ans += (w - i - 1) / step + 2;
        }
    }
    std::cout << ans << std::endl;
}
0