結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-21 03:03:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 575 bytes |
| コンパイル時間 | 1,613 ms |
| コンパイル使用メモリ | 166,704 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-04 02:44:53 |
| 合計ジャッジ時間 | 10,852 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 3 TLE * 3 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main()
{
int A, B;
int i;
cin >> A >> B;
for (i=max(A, B); i > 0; i--)
{
if (A % i == 0 && B % i == 0)
{
A /= i;
B /= i;
break;
}
}
//cout << A << " " << B << " " << i << endl;
if (min(A, B) == max(A, B) - 1)
{
cout << (min(A, B) + 2) * i << endl;
}
else if (min(A, B) == max(A, B) - 2)
{
cout << (min(A, B) + 1) * i << endl;
}
else
{
cout << -1 << endl;
}
return 0;
}