sameThingButYouLikeKofar's blog

By sameThingButYouLikeKofar, 10 years ago, In English

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 ?

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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?

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    My method is about O(N*N) so TLE is judged what is NlogN method ?

    • »
      »
      »
      10 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      use the Sieve of Eratosthenes, the principle is easy and it will pass the judge's tests

»
10 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Use sieve of Erathosphene. AC

»
10 years ago, # |
  Vote: I like it +16 Vote: I do not like it
actually it has a simple nice solution :D
print(100000..100000+n);