結果
問題 | No.816 Beautiful tuples |
ユーザー |
![]() |
提出日時 | 2019-04-19 21:43:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 500 bytes |
コンパイル時間 | 613 ms |
コンパイル使用メモリ | 63,744 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-22 18:06:51 |
合計ジャッジ時間 | 1,263 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 3 |
ソースコード
#include <iostream> using namespace std; int A,B; int main(){ cin >> A >> B; for(int i=1;i*i<=A+B;i++){ if((A+B)%i==0){ int c = (A+B)/2; if(c!=A && c!=B && (A+c)%B==0 && (B+c)%A==0){ cout << c << endl; return 0; } } } int i = A+B; if(A!=i && B!=i && (A+B)%i==0){ if((A+i)%B==0 && (B+i)%A==0){ cout << i << endl; return 0; } } cout << -1 << endl; }