結果

問題 No.1200 お菓子配り-3
ユーザー KudeKude
提出日時 2020-08-28 22:11:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 886 bytes
コンパイル時間 1,469 ms
コンパイル使用メモリ 163,924 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 23:19:50
合計ジャッジ時間 6,924 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 6 ms
6,940 KB
testcase_08 AC 5 ms
6,944 KB
testcase_09 AC 6 ms
6,944 KB
testcase_10 AC 5 ms
6,944 KB
testcase_11 AC 5 ms
6,940 KB
testcase_12 AC 33 ms
6,944 KB
testcase_13 AC 33 ms
6,940 KB
testcase_14 AC 34 ms
6,944 KB
testcase_15 AC 33 ms
6,944 KB
testcase_16 AC 34 ms
6,940 KB
testcase_17 AC 116 ms
6,944 KB
testcase_18 AC 167 ms
6,940 KB
testcase_19 AC 40 ms
6,940 KB
testcase_20 AC 326 ms
6,940 KB
testcase_21 AC 325 ms
6,940 KB
testcase_22 AC 385 ms
6,940 KB
testcase_23 AC 324 ms
6,944 KB
testcase_24 AC 317 ms
6,940 KB
testcase_25 AC 322 ms
6,940 KB
testcase_26 AC 324 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 259 ms
6,940 KB
testcase_29 AC 697 ms
6,940 KB
testcase_30 AC 690 ms
6,944 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
    int tsz;
    cin >> tsz;
    rep(_, tsz) {
        int x, y;
        cin >> x >> y;
        if (x < y) swap(x, y);
        int p = x + y, q = x - y;
        int d = 1;
        int ans = 0;
        while(d * d <= q) {
            if (q % d == 0) {
                int d2 = q / d;
                rep(_, d == d2 ? 1 : 2) {
                    int s = d + 2, bc = p / s;
                    ans += p % s == 0 && (bc & 1) == (d2 & 1) && bc > d2;
                    swap(d, d2);
                }
            }
            d += 1;
        }
        cout << ans << endl;
    }
}
0