結果
問題 | No.816 Beautiful tuples |
ユーザー | shotoyoo |
提出日時 | 2021-06-15 00:25:03 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 555 bytes |
コンパイル時間 | 392 ms |
コンパイル使用メモリ | 87,396 KB |
実行使用メモリ | 76,128 KB |
最終ジャッジ日時 | 2023-08-26 14:33:23 |
合計ジャッジ時間 | 2,827 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 63 ms
71,256 KB |
testcase_02 | AC | 67 ms
75,136 KB |
testcase_03 | WA | - |
testcase_04 | AC | 68 ms
75,328 KB |
testcase_05 | AC | 69 ms
75,332 KB |
testcase_06 | AC | 66 ms
75,228 KB |
testcase_07 | AC | 65 ms
75,676 KB |
testcase_08 | AC | 65 ms
75,780 KB |
testcase_09 | AC | 65 ms
75,004 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 66 ms
75,176 KB |
testcase_13 | AC | 66 ms
75,680 KB |
testcase_14 | AC | 63 ms
71,496 KB |
ソースコード
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) ### 約数列挙 def fs(n): s = set() for i in range(1,int(n**0.5)+2): if n%i==0: s.add(i) s.add(n//i) l = sorted(list(s)) return l a,b = list(map(int, input().split())) l = fs(a+b) for v in sorted(l): if (a+v)%b==(b+v)%a==0: print(v) break else: print(-1)