P2557 [AHOI2002]芝麻开门 题解
Doveqise
2019-06-07 17:37:15
这道题emmm一道算是乘法原理还是什么balabala的题
大概思路:
输入的数可以分解成素数$a_i$的$k_i$次方之积
然后进行模拟
样例什么的楼下给了可以自己看一下
拿Python怒水一波
~~(才不是因为C++高精度写炸了呢 哼唧)~~
下见代码
~~(什么,不会Python?)~~
Python这种东西在NOIP/NOI赛场上hin有用,推荐一学
快速入门的话看下面链接????
[丢蓝链](https://github.com/luogu-dev/cyaron/wiki/Python-30%E5%88%86%E9%92%9F%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97)
代码丢一下(((逃
```python
lst=dict()
n,k=int(),int()
access=[]
def research(x):
i=2
while i<=x :
if x%i==0 :
access.append(i)
lst[i]=0
while x%i==0 :
x/=i
lst[i]+=k
i+=1
if x>1 :
lst[x]+=1
n,k=map(int,input().split())
research(n)
ans=1
for i in access:
t=0
tmp=1
for j in range(lst[i]+1):
t+=tmp
tmp*=i
ans*=t
print(ans)
```