結果

問題 No.816 Beautiful tuples
ユーザー CvadogsanCvadogsan
提出日時 2019-04-19 21:47:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 647 bytes
コンパイル時間 2,056 ms
コンパイル使用メモリ 199,944 KB
実行使用メモリ 8,744 KB
最終ジャッジ日時 2023-10-24 01:24:05
合計ジャッジ時間 5,969 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define ll long long
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;
int main() {
  INIT;
  
  int a,b;
  cin >> a >> b;
  
  for (size_t c = b-a; c < 10^18; c+=b) {
    if((a+b) % c == 0 && (c+b) % a == 0 && (a+c) % b == 0){
      //cout << c << endl;
      printf("%d", c);
      exit(0);
    }
  }
  //cout << "-1" << endl;
  printf("-1");
  
  return 0;
}
0