結果

問題 No.1200 お菓子配り-3
ユーザー gyouzasushigyouzasushi
提出日時 2020-08-28 22:22:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,537 bytes
コンパイル時間 2,206 ms
コンパイル使用メモリ 194,528 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 23:35:13
合計ジャッジ時間 28,933 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 4 ms
6,944 KB
testcase_03 AC 4 ms
6,944 KB
testcase_04 AC 4 ms
6,940 KB
testcase_05 AC 4 ms
6,944 KB
testcase_06 AC 4 ms
6,944 KB
testcase_07 AC 23 ms
6,940 KB
testcase_08 AC 23 ms
6,940 KB
testcase_09 AC 23 ms
6,944 KB
testcase_10 AC 23 ms
6,940 KB
testcase_11 AC 23 ms
6,940 KB
testcase_12 AC 208 ms
6,940 KB
testcase_13 AC 210 ms
6,940 KB
testcase_14 AC 209 ms
6,940 KB
testcase_15 AC 210 ms
6,944 KB
testcase_16 AC 208 ms
6,940 KB
testcase_17 AC 745 ms
6,944 KB
testcase_18 AC 1,082 ms
6,944 KB
testcase_19 AC 248 ms
6,944 KB
testcase_20 WA -
testcase_21 AC 2,068 ms
6,940 KB
testcase_22 WA -
testcase_23 AC 2,070 ms
6,940 KB
testcase_24 WA -
testcase_25 AC 2,067 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 2 ms
6,948 KB
testcase_28 AC 2,461 ms
6,940 KB
testcase_29 AC 2,456 ms
6,940 KB
testcase_30 AC 2,460 ms
6,944 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int tt;
    cin >> tt;
    while (tt--) {
        ll x, y;
        cin >> x >> y;
        ll ans = 0;
        ll b, c;
        for (ll a = 2; a * a <= 500500500; a++) {
            if ((a * x - y) % (a * a - 1) == 0 &&
                (a * y - x) % (a * a - 1) == 0) {
                b = (a * x - y) / (a * a - 1);
                c = (a * y - x) / (a * a - 1);
                if (b > 0 && c > 0) ans++;
            }
        }
        cout << ans << '\n';
    }
}
0