Gym - 100796K Profact 阶乘的乘积 DFS+剪枝

该博客介绍了ACM ICPC Baltic Selection Contest中的一个问题,即判断大整数是否能表示为一个或多个阶乘的乘积。博主通过DFS搜索并结合剪枝策略解决这个问题,考虑到19!超过10^18,预先计算了1到19的阶乘,并在搜索过程中处理素数阶乘的情况,以避免超时。
摘要由CSDN通过智能技术生成

2015-2016 ACM ICPC Baltic Selection Contest

K. Profact
time limit per test:1 second
memory limit per test:256 megabytes

Alice is bored out of her mind by her math classes. She craves for something much more exciting. That is why she invented a new type of numbers, theprofacts. Alice calls a positive integer number a profact if it can be expressed as a product of one or several factorials.

Just today Alice received n bills. She wonders whether the costs on the bills are profact numbers.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值