結果
問題 |
No.816 Beautiful tuples
|
ユーザー |
|
提出日時 | 2019-08-22 16:42:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 384 bytes |
コンパイル時間 | 3,063 ms |
コンパイル使用メモリ | 192,508 KB |
最終ジャッジ日時 | 2025-01-07 14:37:53 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int a,b; cin>>a>>b; for (int i=1;i*i<=a+b;i++) if (i!=a&&i!=b&&(a+b)%i==0&&(a+i)%b==0&&(b+i)%a==0) { cout<<i<<endl; return 0; } if ((a+a+b)%b==0&&(a+b+b)%a==0) { cout<<a+b<<endl; return 0; } cout<<-1<<endl; return 0; }