結果
| 問題 | No.816 Beautiful tuples | 
| コンテスト | |
| ユーザー |  a | 
| 提出日時 | 2019-04-19 21:36:09 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 401 bytes | 
| コンパイル時間 | 1,703 ms | 
| コンパイル使用メモリ | 167,256 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-22 17:04:42 | 
| 合計ジャッジ時間 | 2,405 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 WA * 4 RE * 1 | 
ソースコード
#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%i) continue;
		long c = a / i - b;
		if ((a + c) % b == 0 && (a + b) % c == 0 && (b + c) % a == 0)
		{
			cout << c << endl;
			return;
		}
	}
	cout << -1 << endl;
}
int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}
            
            
            
        