結果

問題 No.816 Beautiful tuples
ユーザー pasoconhoshii
提出日時 2019-04-20 01:16:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-24 17:57:45
合計ジャッジ時間 1,234 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B = map(int, input().split())

C = -1
for i in range(1, int((A+B)**(1/2)) + 2):
    if A!=i and B!=i and (A+i) >= B and (B+i) >= A:
        if (A+B) % i ==0  and  A != i and B != i and  (A+i)%B == 0 and (B+i)%A==0:
            C = i                
            break
        
if C == -1:            
    i = A+B
    if A != i and B != i and A+i >= B and B+i >= A:
        if (A+i)%B == 0 and (B+i)%A==0:
            C = i
print(C)
0