結果

問題 No.1203 お菓子ゲーム
ユーザー ChanyuhChanyuh
提出日時 2020-08-29 11:05:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 645 ms / 2,000 ms
コード長 844 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 78,580 KB
最終ジャッジ日時 2024-04-26 16:13:59
合計ジャッジ時間 18,954 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 308 ms
77,316 KB
testcase_01 AC 348 ms
76,416 KB
testcase_02 AC 210 ms
77,568 KB
testcase_03 AC 434 ms
77,440 KB
testcase_04 AC 181 ms
76,800 KB
testcase_05 AC 448 ms
77,308 KB
testcase_06 AC 304 ms
76,544 KB
testcase_07 AC 406 ms
77,184 KB
testcase_08 AC 324 ms
77,444 KB
testcase_09 AC 290 ms
77,328 KB
testcase_10 AC 473 ms
78,088 KB
testcase_11 AC 190 ms
77,056 KB
testcase_12 AC 294 ms
76,544 KB
testcase_13 AC 285 ms
77,668 KB
testcase_14 AC 290 ms
76,928 KB
testcase_15 AC 492 ms
77,440 KB
testcase_16 AC 224 ms
76,928 KB
testcase_17 AC 388 ms
76,416 KB
testcase_18 AC 51 ms
58,624 KB
testcase_19 AC 142 ms
76,544 KB
testcase_20 AC 37 ms
52,352 KB
testcase_21 AC 36 ms
52,224 KB
testcase_22 AC 37 ms
51,968 KB
testcase_23 AC 36 ms
52,096 KB
testcase_24 AC 38 ms
52,224 KB
testcase_25 AC 35 ms
51,968 KB
testcase_26 AC 37 ms
52,224 KB
testcase_27 AC 35 ms
52,096 KB
testcase_28 AC 37 ms
51,968 KB
testcase_29 AC 38 ms
52,096 KB
testcase_30 AC 522 ms
77,960 KB
testcase_31 AC 548 ms
77,696 KB
testcase_32 AC 510 ms
76,696 KB
testcase_33 AC 505 ms
77,056 KB
testcase_34 AC 536 ms
77,832 KB
testcase_35 AC 645 ms
77,548 KB
testcase_36 AC 502 ms
77,568 KB
testcase_37 AC 487 ms
76,800 KB
testcase_38 AC 497 ms
77,568 KB
testcase_39 AC 510 ms
77,960 KB
testcase_40 AC 555 ms
78,580 KB
testcase_41 AC 496 ms
76,800 KB
testcase_42 AC 531 ms
77,540 KB
testcase_43 AC 575 ms
78,232 KB
testcase_44 AC 536 ms
77,184 KB
testcase_45 AC 532 ms
77,060 KB
testcase_46 AC 509 ms
77,184 KB
testcase_47 AC 581 ms
77,952 KB
testcase_48 AC 525 ms
76,928 KB
testcase_49 AC 555 ms
77,676 KB
testcase_50 AC 42 ms
57,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor_list(x):
  res=[]
  i=1
  while i*i<=x:
    if x%i==0:
      res.append(i)
      if i*i!=x:
        res.append(x//i)
    i+=1
  return res
        
n=int(input())
for i in range(n):
  ans=0
  x,y=map(int,input().split())
  #print(x,y)
  Dy=divisor_list(y)
  for d in Dy:
    if d%2==0:
      continue
    b=(d+1)//2
    if 2*b*(b-1)*y%((2*b-1)*x)!=0:
      continue
    A=2*b*(b-1)*y//((2*b-1)*x)
    #print(A,2*b-1)
    if A<=0 or A>100000000:  continue
    if A<=2*b-1: continue
    ans+=1
  for d in Dy:
    if d%2==0:
      continue
    a=(d+1)//2
    if 2*a*(a-1)*y%((2*a-1)*(y-x))!=0:
      continue
    B=2*a*(a-1)*y//((2*a-1)*(y-x))
    #print(2*a-1,B)
    if B<=0 or B>100000000: continue
    if B<=2*a-1: continue
    ans+=1
  if y>2*x:
    ans+=100000000//y
  if y>2*(y-x):
    ans+=100000000//y
  print(ans)
    
    
  
0