結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
a
|
| 提出日時 | 2019-04-19 21:33:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 387 bytes |
| コンパイル時間 | 1,583 ms |
| コンパイル使用メモリ | 166,508 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 16:51:12 |
| 合計ジャッジ時間 | 2,130 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 5 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
void solve()
{
long a, b;
cin >> a >> b;
if (a < b) swap(a, b);
for (long i = 1; i * i <= a; i++)
{
if ((a-b)%i) continue;
long c = (a - b) / i;
if ((a + c) % b == 0 && (a + b) % c == 0)
{
cout << c << endl;
return;
}
}
cout << -1 << endl;
}
int main()
{
solve();
//cout << "yui(*-v・)yui" << endl;
return 0;
}
a