nefu117 - 素数个数的位数
以前没注意到floor()返回的是double型的数据,
素数定理的应用,,,
代码如下:
#include <cstdio> #include <cmath> int main () { long long n; while(scanf("%lld",&n)==1) { double tt = log10(n)+log10(log(10.0)); printf("%.0lf\n",floor(n-tt)+1); } return 0; }犯错代码:
#include <cstdio> #include <cmath> int main () { long long n; while(scanf("%lld",&n)==1) { double tt = log10(n)+log10(log(10.0)); printf("%d\n",floor(n-tt)+1); } return 0; }