結果

問題 No.2798 Multiple Chain
ユーザー anan
提出日時 2024-06-28 23:14:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 1,148 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 67,712 KB
最終ジャッジ日時 2024-06-28 23:14:43
合計ジャッジ時間 4,956 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
67,328 KB
testcase_01 AC 61 ms
67,456 KB
testcase_02 AC 60 ms
67,072 KB
testcase_03 AC 61 ms
66,944 KB
testcase_04 AC 69 ms
67,072 KB
testcase_05 AC 61 ms
66,944 KB
testcase_06 AC 62 ms
66,944 KB
testcase_07 AC 63 ms
67,072 KB
testcase_08 AC 64 ms
66,944 KB
testcase_09 AC 65 ms
66,944 KB
testcase_10 AC 63 ms
67,072 KB
testcase_11 AC 62 ms
66,944 KB
testcase_12 AC 60 ms
67,456 KB
testcase_13 AC 65 ms
66,816 KB
testcase_14 AC 83 ms
66,944 KB
testcase_15 AC 66 ms
67,072 KB
testcase_16 AC 66 ms
66,816 KB
testcase_17 AC 65 ms
67,456 KB
testcase_18 AC 62 ms
67,456 KB
testcase_19 AC 62 ms
67,072 KB
testcase_20 AC 63 ms
67,328 KB
testcase_21 AC 63 ms
67,712 KB
testcase_22 AC 63 ms
66,944 KB
testcase_23 AC 65 ms
67,328 KB
testcase_24 AC 63 ms
67,584 KB
testcase_25 AC 63 ms
66,944 KB
testcase_26 AC 62 ms
67,456 KB
testcase_27 AC 62 ms
66,688 KB
testcase_28 AC 62 ms
67,072 KB
testcase_29 AC 63 ms
67,072 KB
testcase_30 AC 87 ms
67,072 KB
testcase_31 AC 62 ms
67,072 KB
testcase_32 AC 62 ms
67,328 KB
testcase_33 AC 63 ms
67,456 KB
testcase_34 AC 63 ms
67,200 KB
testcase_35 AC 64 ms
67,456 KB
testcase_36 AC 64 ms
67,200 KB
testcase_37 AC 62 ms
66,816 KB
testcase_38 AC 62 ms
67,328 KB
testcase_39 AC 67 ms
66,944 KB
testcase_40 AC 64 ms
67,072 KB
testcase_41 AC 62 ms
66,688 KB
testcase_42 AC 64 ms
66,944 KB
testcase_43 AC 65 ms
66,688 KB
testcase_44 AC 64 ms
66,944 KB
testcase_45 AC 63 ms
66,944 KB
testcase_46 AC 85 ms
66,688 KB
testcase_47 AC 62 ms
66,688 KB
testcase_48 AC 62 ms
66,688 KB
testcase_49 AC 62 ms
66,688 KB
testcase_50 AC 63 ms
66,816 KB
testcase_51 AC 63 ms
67,456 KB
testcase_52 AC 63 ms
67,200 KB
testcase_53 AC 63 ms
67,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
V=[0,0]
for K in range(2,70):
  dp=[]
  for j in range(K+1):
    dp.append([0]*(K+1))
  for j in range(1,K+1):
    dp[j][K-j]=1
  for j in range(K,0,-1):
    for k in range(K,0,-1):
      #print(j,k)
      if dp[j][k]==0:
        continue
      for l in range(1,j+1):
        #print(l,j,k)
        if k-l<0:
          break
        #print(l,j,k)
        dp[l][k-l]+=dp[j][k]
      #print(dp)
  cnt=0
  #print(dp)
  for i in range(1,K+1):
    cnt+=dp[i][0]
  V.append(cnt)
def fact(M):
  C=[]
  for i in range(2,10**6+1):
    if i==1:
      break
    if M%i==0:
      cnt=0
      while M%i==0:
        M=M//i
        cnt+=1
      if cnt>=2:
        C.append((i,cnt))
  if C==[] and M==1:
    return 1
  elif C==[]:
    H=int(M**0.5)
    ok=0
    for i in range(H-3,H+5):
      if i**2==M:
        return 2
    return 1
  else:
    if M==1:
      return C
    else:
      H=int(M**0.5)
      ok=0
      for i in range(H-3,H+5):
        if i**2==M:
          C.append((i,2))
      return C
C=fact(N)
#print(V)
#print(type(5)==int)
if type(C)==int:
  print(C)
else:
  ans=1
  for i in range(len(C)):
    ans=ans*V[C[i][1]]
  print(ans)  
0