結果

問題 No.1113 二つの整数 / Two Integers
ユーザー CELICACELICA
提出日時 2020-08-05 15:58:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 942 bytes
コンパイル時間 1,598 ms
コンパイル使用メモリ 170,536 KB
実行使用メモリ 7,800 KB
最終ジャッジ日時 2023-10-17 06:05:54
合計ジャッジ時間 5,557 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 87 ms
4,348 KB
testcase_03 AC 71 ms
4,348 KB
testcase_04 AC 72 ms
4,348 KB
testcase_05 AC 972 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using ll = long long;

using namespace std;

ll gcd(ll a, ll b)
{
    if (a == 1 || b == 1)
        return 1;

    ll m{ a }, n{ b };

    while (m != n)
        m > n ? m -= n : n -= m;

    return m;
}

vector<pair<ll, ll> > primeFactorize(ll n)
{
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= n; ++a)
    {
        if (n % a != 0)
            continue;
        ll ex = 0;

        while (n % a == 0)
        {
            ++ex;
            n /= a;
        }

        res.push_back({ a, ex });
    }

    if (n != 1)
        res.push_back({ n, 1 });

    return res;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll a, b;

    scanf("%lld%lld", &a, &b);

    ll g = gcd(a, b);

    vector<pair<ll, ll> > p = primeFactorize(g);

    ll res{ 1 };

    for (const auto& ip : p)
        res *= (ip.second + 1);

    printf("%s", res & 1 ? "Odd\n": "Even\n");

    return 0;
}
0