結果
問題 |
No.1113 二つの整数 / Two Integers
|
ユーザー |
![]() |
提出日時 | 2020-07-17 21:42:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,351 bytes |
コンパイル時間 | 1,949 ms |
コンパイル使用メモリ | 197,892 KB |
最終ジャッジ日時 | 2025-01-11 22:29:03 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 TLE * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; using i64 = long long; using u64 = unsigned long long; #define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i) #ifdef ENABLE_DEBUG template <typename T> void debug(T value) { cerr << value; } template <typename T, typename... Ts> void debug(T value, Ts... args) { cerr << value << ", "; debug(args...); } #define DEBUG(...) \ do { \ cerr << " \033[33m (L" << __LINE__ << ") "; \ cerr << #__VA_ARGS__ << ":\033[0m "; \ debug(__VA_ARGS__); \ cerr << endl; \ } while (0) #else #define debug(...) #define DEBUG(...) #endif vector<pair<i64, int>> factorize(i64 n) { vector<pair<i64, int>> res; for (i64 k = 2; k * k <= n; ++k) { int cnt = 0; while (n % k == 0) { n /= k; ++cnt; } if (cnt > 0) { res.emplace_back(k, cnt); } } if (n > 1) { res.emplace_back(n, 1); } return res; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); i64 A, B; cin >> A >> B; i64 g = std::gcd(A, B); auto fs = factorize(g); bool is_odd = true; for (auto [_, k] : fs) { if ((k + 1) % 2 == 0) { is_odd = false; break; } } cout << (is_odd ? "Odd" : "Even") << endl; }