結果

問題 No.1203 お菓子ゲーム
ユーザー 259_Momone259_Momone
提出日時 2020-08-28 22:51:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,005 bytes
コンパイル時間 2,209 ms
コンパイル使用メモリ 196,196 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 13:40:46
合計ジャッジ時間 10,867 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
6,812 KB
testcase_01 AC 157 ms
6,812 KB
testcase_02 AC 52 ms
6,944 KB
testcase_03 AC 196 ms
6,940 KB
testcase_04 AC 55 ms
6,944 KB
testcase_05 AC 219 ms
6,940 KB
testcase_06 AC 135 ms
6,940 KB
testcase_07 AC 204 ms
6,944 KB
testcase_08 AC 111 ms
6,940 KB
testcase_09 AC 101 ms
6,940 KB
testcase_10 AC 229 ms
6,944 KB
testcase_11 AC 57 ms
6,940 KB
testcase_12 AC 128 ms
6,944 KB
testcase_13 AC 90 ms
6,940 KB
testcase_14 AC 113 ms
6,940 KB
testcase_15 AC 244 ms
6,940 KB
testcase_16 AC 83 ms
6,940 KB
testcase_17 AC 177 ms
6,940 KB
testcase_18 AC 3 ms
6,944 KB
testcase_19 AC 22 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 WA -
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 247 ms
6,940 KB
testcase_31 AC 265 ms
6,940 KB
testcase_32 AC 256 ms
6,940 KB
testcase_33 AC 251 ms
6,940 KB
testcase_34 AC 262 ms
6,940 KB
testcase_35 AC 245 ms
6,944 KB
testcase_36 AC 242 ms
6,940 KB
testcase_37 AC 249 ms
6,940 KB
testcase_38 AC 258 ms
6,940 KB
testcase_39 AC 247 ms
6,940 KB
testcase_40 AC 274 ms
6,944 KB
testcase_41 AC 268 ms
6,940 KB
testcase_42 AC 265 ms
6,944 KB
testcase_43 AC 264 ms
6,944 KB
testcase_44 AC 257 ms
6,944 KB
testcase_45 AC 264 ms
6,944 KB
testcase_46 AC 258 ms
6,940 KB
testcase_47 AC 275 ms
6,940 KB
testcase_48 AC 263 ms
6,940 KB
testcase_49 AC 264 ms
6,940 KB
testcase_50 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long S;
    cin >> S;
    const auto& calc = [&](auto X, auto Y) -> unsigned long {
        if(2 * X >= Y)return 0;
        unsigned long ret{0};
        ret += 100000000 / Y;
        for(unsigned long i{1}; i * i <= Y; ++i){
            if(Y % i == 0){
                if(i & 1){
                    unsigned long l{Y * (i + 1) * (i - 1) / (2 * i)};
                    ret += l && l % X == 0 && l / X <= 100000000;
                }
                if(i * i < Y && (Y / i) & 1){
                    unsigned long l{i * (Y / i + 1) * (Y / i - 1) / 2};
                    if(static_cast<__int128>(i) * (Y / i + 1) * (Y / i - 1) / 200000000 > X)continue;
                    ret += l && l % X == 0 && l / X <= 100000000;
                }
            }
        }
        return ret;
    };
    for(unsigned long i{0}, X, Y; i < S; ++i){
        cin >> X >> Y;
        cout << calc(min(X, Y - X), Y) << endl;
    }
    return 0;
}
0