結果

問題 No.1113 二つの整数 / Two Integers
ユーザー bonKotsubonKotsu
提出日時 2021-05-29 18:42:43
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 659 bytes
コンパイル時間 1,530 ms
コンパイル使用メモリ 164,760 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-07 20:20:26
合計ジャッジ時間 2,738 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>

ll gcd(ll a, ll b) {
  return a%b ? gcd(b, a%b) : b;
}

bool isSquare(ll x) {
  ll ac = 0, wa = 1e9+5;
  while (wa-ac>1) {
    ll wj = (wa+ac)/2;
    if (wj*wj <= x) ac = wj;
    else wa = wj;
  }
  ll wa2 = 0, ac2 = 1e9+5;
  while (ac2-wa2>1) {
    ll wj = (wa2+ac2)/2;
    if (wj*wj >= x) ac2 = wj;
    else wa2 = wj;
  }

  if (ac == ac2) return true;
  else return false;

}

int main() {
  ll a, b;
  cin >> a >> b;
  ll g = gcd(a,b);


  if (isSquare(g)) cout << "Odd" << endl;
  else cout << "Even" << endl;

}
0