結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
irohasu_takaoka
|
| 提出日時 | 2019-05-03 20:40:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 987 bytes |
| コンパイル時間 | 1,116 ms |
| コンパイル使用メモリ | 82,188 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-12-31 16:10:21 |
| 合計ジャッジ時間 | 18,779 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 5 |
ソースコード
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<vector>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)
using namespace std;
ll pow(int x, int n){
return n == 0 ? 1 : x * pow(x, n - 1);
}
void Yn(bool f)
{
cout << (f ? "Yes" : "No") << endl;
}
void yn(bool f)
{
cout << (f ? "yes" : "no") << endl;
}
void YN(bool f)
{
cout << (f ? "YES" : "NO") << endl;
}
ll a, b;
ll solve(){
if(a == b)
return -1;
for (ll i = 1; i <= a + b; i++)
{
if (a == i || b == i)
continue;
if ((a + b) % i == 0 && (a+i)%b == 0 && (b+i)%a == 0)
return i;
}
return -1;
}
int main()
{
cin >> a>>b;
cout << solve() << endl;
return 0;
}
irohasu_takaoka