結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
albusSamurai
|
| 提出日時 | 2019-04-20 01:54:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 381 bytes |
| コンパイル時間 | 1,640 ms |
| コンパイル使用メモリ | 167,384 KB |
| 実行使用メモリ | 13,756 KB |
| 最終ジャッジ日時 | 2024-09-24 17:59:29 |
| 合計ジャッジ時間 | 6,693 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 2 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) ans = C;
}
}
cout << ans << endl;
}
albusSamurai