結果

問題 No.1200 お菓子配り-3
ユーザー marroncastlemarroncastle
提出日時 2020-08-29 19:17:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 2,518 ms
コンパイル使用メモリ 82,268 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-27 01:15:41
合計ジャッジ時間 23,636 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,680 KB
testcase_01 AC 40 ms
57,464 KB
testcase_02 AC 41 ms
58,460 KB
testcase_03 AC 42 ms
58,536 KB
testcase_04 AC 45 ms
58,724 KB
testcase_05 AC 46 ms
58,612 KB
testcase_06 AC 46 ms
57,864 KB
testcase_07 AC 61 ms
59,364 KB
testcase_08 AC 62 ms
60,344 KB
testcase_09 AC 59 ms
59,692 KB
testcase_10 AC 59 ms
58,904 KB
testcase_11 AC 59 ms
58,372 KB
testcase_12 AC 210 ms
70,820 KB
testcase_13 AC 211 ms
71,572 KB
testcase_14 AC 212 ms
70,076 KB
testcase_15 AC 215 ms
70,176 KB
testcase_16 AC 210 ms
70,492 KB
testcase_17 AC 606 ms
76,604 KB
testcase_18 AC 845 ms
76,348 KB
testcase_19 AC 245 ms
70,980 KB
testcase_20 AC 1,499 ms
76,540 KB
testcase_21 AC 1,495 ms
76,576 KB
testcase_22 AC 1,773 ms
76,596 KB
testcase_23 AC 1,546 ms
76,348 KB
testcase_24 AC 1,540 ms
76,460 KB
testcase_25 AC 1,536 ms
76,380 KB
testcase_26 AC 1,466 ms
76,672 KB
testcase_27 AC 41 ms
52,408 KB
testcase_28 AC 1,158 ms
76,584 KB
testcase_29 AC 3,138 ms
76,180 KB
testcase_30 AC 3,267 ms
76,060 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor(n):
  cd = []
  i = 1
  while i*i <= n:
    if n%i==0:
      cd.append(i)
    i += 1
  return cd

def check(bpc,bmc):
  if (bpc+bmc)%2==1:
    return False
  if bpc-bmc<=0:
    return False
  return True

def solve():
  S = int(input())
  ans = [0]*S
  for s in range(S):
    X, Y = map(int, input().split())
    d = abs(X-Y)
    xy = X+Y
    divs = divisor(d)
    for div in divs:
      div2 = d//div
      if xy%(div+2)==0:
        bpc = xy//(div+2)
        bmc = div2
        if check(bpc,bmc):
          ans[s] += 1
      if xy%(div2+2)==0:
        bpc = xy//(div2+2)
        bmc = div
        if check(bpc,bmc):
          ans[s] += 1
  return ans
print(*solve(),sep='\n')
0