Nộp bài | Các bài nộp | Làm tốt nhất | Về danh sách bài |
CPRIME - Prime Number Theorem |
English | Vietnamese |
In number theory, the Prime Number Theorem describes the asymptotic distribution of prime numbers. Let π(x) be the number of prime numbers not greater than x. The Prime Number Theorem states that:
Your task is to write a program to verify how well the Prime Number Theorem can estimate π(x). To be more precise, for a given x, you have to calculate the percent error |π(x) - x/lnx| / π(x) %.
Input
The input contains several test cases (no more than 1000). Each test case contains a value of x (2 ≤ x ≤ 108) given in one line. A number 0 terminates the input.
Output
For each value of x, output the percent error of the estimation of π(x), rounded to 1 decimal digit.
Example
Input: 10000000 2 3 5 1234567 0 Output: 6.6 188.5 36.5 3.6 7.7
Được gửi lên bởi: | Jimmy |
Ngày: | 2008-12-11 |
Thời gian chạy: | 1.812s |
Giới hạn mã nguồn: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Ngôn ngữ cho phép: | Tất cả ngoại trừ: ERL GOSU JS-RHINO NODEJS PERL6 PYPY RUST SED VB.NET |
Nguồn bài: | Tic Tac Toe |
hide comments
2015-09-08 14:13:29
https://thewizard6296.wordpress.com/2015/09/04/5/ |
|
2014-02-09 14:55:23 a;slkfjasl;fkj
20s mà vẫn chạy quá lâu o.O |