結果

問題 No.1113 二つの整数 / Two Integers
ユーザー KKT89
提出日時 2020-07-17 21:52:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 1,000 ms
コード長 1,077 bytes
コンパイル時間 1,551 ms
コンパイル使用メモリ 119,172 KB
最終ジャッジ日時 2025-01-11 22:35:22
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

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