as title says , i'm talking about http://codeforces.me/problemset/problem/327/B problem
that judged as TLE. my submission was only trying to print prime numbers
what are other sequences that aren't prime and aren't divisible terms ?
# | User | Rating |
---|---|---|
1 | tourist | 3856 |
2 | jiangly | 3747 |
3 | orzdevinwang | 3706 |
4 | jqdai0815 | 3682 |
5 | ksun48 | 3591 |
6 | gamegame | 3477 |
7 | Benq | 3468 |
8 | Radewoosh | 3462 |
9 | ecnerwala | 3451 |
10 | heuristica | 3431 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 162 |
3 | Dominater069 | 160 |
4 | Um_nik | 158 |
5 | atcoder_official | 157 |
6 | Qingyu | 156 |
7 | djm03178 | 151 |
7 | adamant | 151 |
9 | luogu_official | 150 |
10 | awoo | 147 |
as title says , i'm talking about http://codeforces.me/problemset/problem/327/B problem
that judged as TLE. my submission was only trying to print prime numbers
what are other sequences that aren't prime and aren't divisible terms ?
Name |
---|
what method did you use to print the prime numbers? (there is one in NlogN, N being the range of the numbers) and the PNT guarantees that there exist about 10^5 < 10^7/ln(10^7) prime number <10^7, so why not prime numbers?
My method is about O(N*N) so TLE is judged what is NlogN method ?
use the Sieve of Eratosthenes, the principle is easy and it will pass the judge's tests
Use sieve of Erathosphene. AC
Also you can print n to 2n-1 and get AC :P