1.求 不能组合出的最大的数,以及个数
http://acm.hdu.edu.cn/showproblem.php?pid=1792
结论:
①:不能组合出的最大数:
②:个数:
没怎么看懂的证明:
http://blog.sina.com.cn/s/blog_79b832820100riqp.html
2.斐波那契数列平方和
结论:
3.n的阶乘在m进制下末尾0的个数
没有懂原理。。。
#include"bits/stdc++.h"
#define out(x) cout<<#x<<"="<<x
using namespace std;
typedef long long LL;
LL solve(LL n,LL m)
{
LL res=0;
while(n)
{
res+=n/m;
n/=m;
}
return res;
}
int main()
{
LL N,M;
while(cin>>N>>M)
{
LL ans=1e18;
for(LL i=2;i*i<=M;i++)
{
if(M%i==0)
{
LL cnt=0;
while(M%i==0)M/=i,cnt++;
ans=min(ans,solve(N,i)/cnt);
}
}
cout<<ans<<endl;
}
}
4.格点多边形面积(皮克定理)
为内部格点的数目
为边上格点的数目