結果

問題 No.1113 二つの整数 / Two Integers
ユーザー c-yanc-yan
提出日時 2020-07-17 22:19:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 912 bytes
コンパイル時間 1,911 ms
コンパイル使用メモリ 201,072 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-07 09:19:35
合計ジャッジ時間 3,188 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 42 ms
5,376 KB
testcase_03 AC 95 ms
5,376 KB
testcase_04 AC 36 ms
5,376 KB
testcase_05 AC 95 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 39 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 8 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
using namespace std;
using ll = long long;

int main() {
    ll A, B;
    cin >> A >> B;

    ll X = gcd(A, B);

    bool flag = false;
    for (ll i = 2; i < 1e7; i++) {
        if (X % i == 0) {
            flag = true;
            break;
        }
    }

    if (!flag) {
        cout << "Even" << endl;
        return 0;
    }

    ll result = 1;
    ll t = 0;
    while (X % 2 == 0) {
        t++;
        X /= 2;
    }
    result *= t + 1;

    for (ll i = 3; i < (ll)(sqrt(X) + 1); i += 2) {
        if (X % i != 0) continue;

        ll t = 0;
        while (X % i == 0) {
            t++;
            X /= i;
        }
        result *= t + 1;
    }
    if (X != 1) {
        result *= 2;
    }

    if (result % 2 == 0) {
        cout << "Even" << endl;
    } else {
        cout << "Odd" << endl;
    }

    return 0;
}
0