結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
leaf_1415
|
| 提出日時 | 2019-04-19 21:26:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 477 bytes |
| コンパイル時間 | 652 ms |
| コンパイル使用メモリ | 66,632 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 16:23:58 |
| 合計ジャッジ時間 | 1,381 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 4 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#define llint long long
using namespace std;
llint a, b;
vector<llint> vec;
int main(void)
{
cin >> a >> b;
for(llint i = 1; i <= 1000000; i++){
if((a+b)%i == 0) vec.push_back(i), vec.push_back((a+b)/i);
}
sort(vec.begin(), vec.end());
for(llint i = 0; i < vec.size(); i++){
llint c = vec[i];
if((b+c)%a == 0 && (c+a)%b == 0){
cout << c << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}
leaf_1415