結果
| 問題 | No.853 河原の石 | 
| コンテスト | |
| ユーザー |  trineutron | 
| 提出日時 | 2020-04-14 18:32:31 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 449 bytes | 
| コンパイル時間 | 693 ms | 
| コンパイル使用メモリ | 66,048 KB | 
| 最終ジャッジ日時 | 2025-01-09 18:52:03 | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 4 WA * 44 TLE * 9 | 
ソースコード
#include <iostream>
int main() {
    int h, w, step = 1;
    long ans = 0;
    std::cin >> h >> w;
    if (w < 0) {
        w = -w;
    } else if (w == 0) {
        std::cout << 0 << std::endl;
        return 0;
    }
    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;
}
            
            
            
        