結果
問題 | No.1113 二つの整数 / Two Integers |
ユーザー |
|
提出日時 | 2021-05-29 18:42:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 659 bytes |
コンパイル時間 | 1,708 ms |
コンパイル使用メモリ | 165,716 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 01:42:33 |
合計ジャッジ時間 | 2,515 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
#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; }