結果
| 問題 | No.816 Beautiful tuples |
| コンテスト | |
| ユーザー |
albusSamurai
|
| 提出日時 | 2019-04-20 01:55:56 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 419 bytes |
| 記録 | |
| コンパイル時間 | 846 ms |
| コンパイル使用メモリ | 184,108 KB |
| 実行使用メモリ | 11,304 KB |
| 最終ジャッジ日時 | 2026-04-11 21:09:24 |
| 合計ジャッジ時間 | 4,683 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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