結果

問題 No.1113 二つの整数 / Two Integers
ユーザー elphe
提出日時 2024-11-09 12:15:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 788 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 66,156 KB
最終ジャッジ日時 2025-02-25 03:17:42
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <cstdint>
using namespace std;
template<typename T1, typename T2> constexpr decltype((T1)1 % (T2)1) GCD(const T1 a, const T2 b) noexcept
{
decltype((T1)1 % (T2)1) x = a, y = b, z = 0;
while (y != 0) z = x % y, x = y, y = z;
return x;
}
template<typename T1, typename T2> constexpr bool is_squared(const T1 target, T2 l, T2 r) noexcept
{
while (l + 1 < r)
{
const T2 c = l + (r - l) / 2;
const decltype((T1)1 * (T2)1) c_squared = static_cast<decltype((T1)1 * (T2)1)>(c) * c;
if (c_squared < target) l = c + 1;
else if (c_squared != target) r = c;
else return true;
}
return false;
}
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
uint64_t A, B;
cin >> A >> B;
if (is_squared(GCD(A, B), 1, 1'000'000'001));
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0