結果

問題 No.1200 お菓子配り-3
ユーザー KudeKude
提出日時 2020-08-28 22:11:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 886 bytes
コンパイル時間 1,810 ms
コンパイル使用メモリ 164,700 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-09 08:45:30
合計ジャッジ時間 7,440 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 5 ms
4,384 KB
testcase_08 AC 5 ms
4,384 KB
testcase_09 AC 5 ms
4,384 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 4 ms
4,384 KB
testcase_12 AC 34 ms
4,384 KB
testcase_13 AC 33 ms
4,380 KB
testcase_14 AC 34 ms
4,384 KB
testcase_15 AC 34 ms
4,380 KB
testcase_16 AC 34 ms
4,380 KB
testcase_17 AC 118 ms
4,384 KB
testcase_18 AC 169 ms
4,380 KB
testcase_19 AC 40 ms
4,380 KB
testcase_20 AC 325 ms
4,384 KB
testcase_21 AC 325 ms
4,384 KB
testcase_22 AC 382 ms
4,380 KB
testcase_23 AC 325 ms
4,384 KB
testcase_24 AC 319 ms
4,380 KB
testcase_25 AC 324 ms
4,380 KB
testcase_26 AC 323 ms
4,384 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 262 ms
4,380 KB
testcase_29 AC 697 ms
4,380 KB
testcase_30 AC 695 ms
4,384 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