結果
| 問題 | No.816 Beautiful tuples |
| コンテスト | |
| ユーザー |
albusSamurai
|
| 提出日時 | 2019-04-20 01:55:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 1,495 ms |
| コンパイル使用メモリ | 167,312 KB |
| 実行使用メモリ | 13,880 KB |
| 最終ジャッジ日時 | 2024-09-24 17:59:53 |
| 合計ジャッジ時間 | 6,217 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 1 -- * 9 |
ソースコード
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
int A, B;
cin >> A >> B;
int ans = ((2*A+B)%B == 0 && (A+2*B)%A == 0) ? A+B : -1;
for (int K = 2; K < A+B; K++) {
if ((A+B)%K == 0) {
int C = (A+B)/K;
if ((A+C)%B == 0 && (B+C)%A == 0 && C != A && C != B) {
ans = C;
}
}
}
cout << ans << endl;
}
albusSamurai