結果
問題 | No.2954 Calculation of Exponentiation |
ユーザー | lif4635 |
提出日時 | 2024-11-08 21:27:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,165 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 88,576 KB |
最終ジャッジ日時 | 2024-11-08 21:27:53 |
合計ジャッジ時間 | 6,344 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 162 ms
88,448 KB |
testcase_01 | AC | 181 ms
88,448 KB |
testcase_02 | AC | 153 ms
88,448 KB |
testcase_03 | AC | 153 ms
88,320 KB |
testcase_04 | AC | 157 ms
88,064 KB |
testcase_05 | AC | 156 ms
87,936 KB |
testcase_06 | AC | 159 ms
88,320 KB |
testcase_07 | AC | 157 ms
88,064 KB |
testcase_08 | AC | 182 ms
88,320 KB |
testcase_09 | AC | 152 ms
88,192 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 158 ms
88,320 KB |
testcase_14 | AC | 155 ms
88,320 KB |
testcase_15 | AC | 160 ms
88,064 KB |
testcase_16 | AC | 153 ms
88,064 KB |
testcase_17 | AC | 157 ms
87,936 KB |
testcase_18 | AC | 156 ms
88,448 KB |
testcase_19 | AC | 155 ms
88,448 KB |
testcase_20 | AC | 156 ms
88,192 KB |
testcase_21 | AC | 155 ms
88,448 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 156 ms
88,448 KB |
testcase_25 | AC | 156 ms
88,448 KB |
testcase_26 | AC | 155 ms
88,320 KB |
testcase_27 | AC | 160 ms
88,448 KB |
testcase_28 | AC | 160 ms
88,320 KB |
testcase_29 | AC | 160 ms
88,448 KB |
testcase_30 | AC | 153 ms
88,320 KB |
ソースコード
def II(): return int(input()) def MI(): return map(int, input().split()) def TI(): return tuple(MI()) def LI(): return list(MI()) #str-input def SI(): return input() def MSI(): return input().split() def SI_L(): return list(SI()) def SI_LI(): return list(map(int, SI())) #multiple-input def LLI(n): return [LI() for _ in range(n)] def LSI(n): return [SI() for _ in range(n)] #1-indexを0-indexでinput def MI_1(): return map(lambda x:int(x)-1, input().split()) def TI_1(): return tuple(MI_1()) def LI_1(): return list(MI_1()) class fenwick_tree(): n=1 data=[0 for i in range(n)] def __init__(self,N): self.n=N self.data=[0 for i in range(N)] def add(self,p,x): assert 0<=p<self.n,"0<=p<n,p={0},n={1}".format(p,self.n) p+=1 while(p<=self.n): self.data[p-1]+=x p+=p& -p def sum(self,l,r): assert (0<=l and l<=r and r<=self.n),"0<=l<=r<=n,l={0},r={1},n={2}".format(l,r,self.n) return self.sum0(r)-self.sum0(l) def sum0(self,r): s=0 while(r>0): s+=self.data[r-1] r-=r&-r return s class dsu(): n=1 parent_or_size=[-1 for i in range(n)] def __init__(self,N): self.n=N self.parent_or_size=[-1 for i in range(N)] def merge(self,a,b): assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n) assert 0<=b<self.n, "0<=b<n,b={0},n={1}".format(b,self.n) x=self.leader(a) y=self.leader(b) if x==y: return x if (-self.parent_or_size[x]<-self.parent_or_size[y]): x,y=y,x self.parent_or_size[x]+=self.parent_or_size[y] self.parent_or_size[y]=x return x def same(self,a,b): assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n) assert 0<=b<self.n, "0<=b<n,b={0},n={1}".format(b,self.n) return self.leader(a)==self.leader(b) def leader(self,a): assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n) if (self.parent_or_size[a]<0): return a self.parent_or_size[a]=self.leader(self.parent_or_size[a]) return self.parent_or_size[a] def size(self,a): assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n) return -self.parent_or_size[self.leader(a)] def groups(self): leader_buf=[0 for i in range(self.n)] group_size=[0 for i in range(self.n)] for i in range(self.n): leader_buf[i]=self.leader(i) group_size[leader_buf[i]]+=1 result=[[] for i in range(self.n)] for i in range(self.n): result[leader_buf[i]].append(i) result2=[] for i in range(self.n): if len(result[i])>0: result2.append(result[i]) return result2 def lis(l): #最長増加部分列 n = len(l) tmp = [] # いまi文字目に使える最小 idxlist = [None] * n # l[i]が使われた場所 for i in range(n): numidx = bisect_right(tmp, l[i]) if numidx == len(tmp): tmp.append(l[i]) else: tmp[numidx] = l[i] idxlist[i] = numidx # LIS復元 look = len(tmp) - 1 ans = [0] * (look + 1) idx = [0] * (look + 1) # 後ろから見ていく for i in range(n-1,-1,-1): if idxlist[i] == look: ans[look] = l[i] # ansを確定 idx[look] = i look -= 1 return ans,idx from bisect import bisect_left,bisect_right from fractions import Fraction def primefact(n:int): #素因数分解 """素因数分解""" p = 2 pf = dict() while p*p <= n: if n%p == 0: cnt = 0 while n%p == 0: n //= p cnt += 1 pf[p] = cnt p += 1 if n != 1: pf[n] = 1 return pf from math import comb,ceil,floor,factorial,gcd a,b = input().split() a = Fraction(a) b = Fraction(b) if a != int(a): print("No") else: k = primefact(int(a)) e = [i for i in k.values()] t = gcd(*e) b *= t if b != int(b): print("No") else: print("Yes")