結果

問題 No.982 Add
ユーザー raven7959raven7959
提出日時 2021-09-16 07:56:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 210 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 76,204 KB
最終ジャッジ日時 2023-09-12 00:25:00
合計ジャッジ時間 3,961 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,360 KB
testcase_01 AC 75 ms
71,104 KB
testcase_02 AC 75 ms
71,268 KB
testcase_03 AC 82 ms
71,264 KB
testcase_04 AC 76 ms
71,328 KB
testcase_05 AC 82 ms
76,104 KB
testcase_06 AC 80 ms
75,964 KB
testcase_07 AC 82 ms
75,796 KB
testcase_08 AC 78 ms
71,108 KB
testcase_09 AC 83 ms
76,204 KB
testcase_10 AC 86 ms
76,032 KB
testcase_11 AC 75 ms
71,408 KB
testcase_12 AC 77 ms
71,692 KB
testcase_13 AC 76 ms
71,396 KB
testcase_14 AC 76 ms
71,432 KB
testcase_15 AC 77 ms
71,328 KB
testcase_16 AC 83 ms
75,900 KB
testcase_17 AC 78 ms
75,828 KB
testcase_18 AC 76 ms
71,256 KB
testcase_19 AC 76 ms
71,132 KB
testcase_20 AC 76 ms
71,236 KB
testcase_21 AC 75 ms
71,232 KB
testcase_22 AC 75 ms
71,128 KB
testcase_23 AC 75 ms
71,252 KB
testcase_24 AC 80 ms
76,120 KB
testcase_25 AC 81 ms
76,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
a,b=map(int,input().split())
g=gcd(a,b)
if g!=1:
  print(-1)
else:
  S=set()
  for i in range(b+1):
    for j in range(a+1):
      if a*i+b*j<a*b:
        S.add(a*i+b*j)
  print(a*b-len(S))
0