結果

問題 No.1203 お菓子ゲーム
ユーザー 259_Momone259_Momone
提出日時 2020-08-28 22:32:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 909 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 195,496 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 13:28:49
合計ジャッジ時間 11,523 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 54 ms
5,376 KB
testcase_03 AC 206 ms
5,376 KB
testcase_04 AC 55 ms
5,376 KB
testcase_05 AC 234 ms
5,376 KB
testcase_06 AC 151 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 118 ms
5,376 KB
testcase_09 AC 106 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 120 ms
5,376 KB
testcase_15 AC 252 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 196 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 22 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 262 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 262 ms
5,376 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 280 ms
5,376 KB
testcase_46 AC 268 ms
5,376 KB
testcase_47 WA -
testcase_48 AC 275 ms
5,376 KB
testcase_49 AC 280 ms
5,376 KB
testcase_50 WA -
権限があれば一括ダウンロードができます

ソースコード

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 k{(i + 1) / 2}, l{Y / i * k * (k - 1)};
                    ret += l && l % X == 0 && l / X <= 100000000;
                }
                if(i * i < Y && (Y / i) & 1){
                    unsigned long k{(Y / i + 1) / 2}, l{i * k * (k - 1)};
                    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