結果

問題 No.1113 二つの整数 / Two Integers
ユーザー KKT89KKT89
提出日時 2020-07-17 21:52:54
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,077 bytes
コンパイル時間 1,748 ms
コンパイル使用メモリ 116,364 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 06:07:57
合計ジャッジ時間 2,679 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,b; cin >> a >> b;
    ll g=__gcd(a,b);
    bool ok=0;
    for(ll i=2;i*i<=1e7;i++){
        if(g%i==0){
            int cnt=0;
            while(g%i==0){
                g/=i;
                cnt++;
            }
            if(cnt%2)ok=1;
        }
    }
    if(ok)printf("Even\n");
    else if(g==1)printf("Odd\n");
    else{
        ll l=2,r=2e9;
        while(r-l>1){
            ll mid=(l+r)/2;
            if(mid*mid<=g){
                l=mid;
            }
            else{
                r=mid;
            }
        }
        if(l*l==g){
            printf("Odd\n");
        }
        else{
            printf("Even\n");
        }
    }
}
0