AHOI2002 芝麻开门 题解

这道题emmm一道算是乘法原理还是什么balabala的题
大概思路: 输入的数可以分解成素数 ai​ 的 ki​ 次方之积
然后进行模拟
样例什么的楼下给了可以自己看一下
拿Python怒水一波
(才不是因为C++高精度写炸了呢 哼唧)
下见代码
(什么,不会Python?)
Python这种东西在NOIP/NOI赛场上hin有用,推荐一学
快速入门的话看下面链接????
丢蓝链
代码丢一下(((逃

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)
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务