3000: Big Number
来源:互联网 发布:国外域名代理商 编辑:程序博客网 时间:2024/05/17 05:01
题目链接
题目大意:求出N!的K进制的位数
题解:给数学跪了。题解
我的收获:Orz
#include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const double pi=acos(-1.0),e=exp(1.0); int n,k; int main() { int i; while(~scanf("%d%d",&n,&k) ) { if(n<=100) { double temp=0; for(i=2;i<=n;i++) temp+=log(i); temp/=log(k); cout<<(long long)floor(temp+1e-7)+1ll<<endl; } else { double temp=log(2*pi*n)/log(k)/2+n*log(n/e)/log(k); cout<<(long long)floor(temp+1e-7)+1ll<<endl; } } return 0; }
阅读全文
0 0
- 3000: Big Number
- big big number 求和
- big number
- Big Number
- Big Number
- big number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- Big Number
- leetcode 144
- 在淘宝上搜索电脑原装扇热器
- 397. Integer Replacement
- sorts-colors
- iscsi远程块存储
- 3000: Big Number
- 【合并果子】的两种方法
- 写博客啦~~
- intellij IDEA常用快捷键整理
- How to Edit Your Hosts File on Windows
- ThoughtWorks 结对编程
- linux平台下防火墙iptables原理
- Button,RadioButton,Time
- bootstrap02栅格系统