submission_id string | problem_id string | status string | code string | input string | output string | problem_description string |
|---|---|---|---|---|---|---|
s322561505 | p00008 | Runtime Error | import sys
[print([670, 660, 633, 592, 540, 480, 415, 348, 282, 220, 165, 120, 84, 56, 35, 20, 10, 4, 1][abs(18 - int(e))]) for e in sys.stdin]
| 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s930076321 | p00008 | Runtime Error | while 1:
n = int(raw_input())
cnt = 0;
for i in range(0, 10):
for j in range(0, 10):
for k in range(0, 10):
for l in range(0, 10):
if n == i+j+k+l: cnt+=1
print cnt | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s819603781 | p00008 | Runtime Error | def keta_sum(n):
a = int(n*0.001)
b = int(n*0.01) % 10
c = int(n*0.1) % 10
d = n % 10
return a+b+c+d
while 2>1:
n_try = int(raw_input())
count = 0
for n in range(10000):
if n_try == keta_sum(n):
count += 1
print count | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s299089078 | p00008 | Runtime Error |
while True:
try:
x = int(raw_input())
count = 0
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a+b+c+d == x :
count += 1
print count
except ValueError:
break | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s334813205 | p00008 | Runtime Error | #!/usr/bin/env python
# coding: utf-8
def count_pattern(i):
n = 0
for a in xrange(10):
for b in xrange(10):
for c in xrange(10):
for d in xrange(10):
if (a + b + c + d) == i:
n += 1
return n
def main():
while 1:
s = raw_input()
if s == "":
return
print count_pattern(int(s))
if __name__ == '__main__':
main() | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s376343064 | p00008 | Runtime Error | import itertools
while True:
n = int(raw_input())
c = 0
for a in itertools.product(range(10), repeat=4):
if sum(a) == n:
c += 1
print c | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s873182395 | p00008 | Runtime Error | while 1:
try:
n = input()
x = 0
if n < 37:
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a + b + c + d == n:
c += 1
print c
except EOFError:
break | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s123757159 | p00008 | Runtime Error | while 1:
try:
n = input()
x = 0
if n < 37:
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
if a + b + c + d == n:
x += 1
print x
except EOFError:
break | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s233305202 | p00008 | Runtime Error | while True:
try:
n = int(raw_input())
count = 0
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
if i+j+k+l == n:
count += 1
print count
except:
break | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s032970165 | p00008 | Runtime Error | import sys
for n in sys.stdin: print len([None for a in range(10) for b in range(10) for c in range(10) for d in range(10) if a+b+c+d == N]) | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s754592810 | p00008 | Runtime Error | import itertools
s,ans=range(0,10),0
chk=list(itertools.combinations_with_replacement(s,4))
for j in sys.stdin:
for k in chk:
if sum(k)==int(j):
ans+=1
print ans | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s047120710 | p00008 | Runtime Error | import itertools
s=range(0,10)
chk=list(itertools.product(s,repeat=4))
for j in sys.stdin:
ans=0
for k in chk:
if sum(k)==int(j):
ans+=1
print ans | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s581876215 | p00008 | Runtime Error | while True:
ans = 0
n = int(raw_input())
for i in xrange(10):
for j in xrange(10):
for k in xrange(10):
for l in xrange(10):
if i+j+k+l == n:
ans += 1
print ans | 35
1
| 4
4
|
<H1>Sum of 4 Integers</H1>
<p>
Write a program which reads an integer <var>n</var> and identifies the number of combinations of <var>a, b, c</var> and <var>d</var> (0 ≤ <var>a, b, c, d</var> ≤ 9) which meet the following equality:<br>
<br>
<var>a + b + c + d = n</var><br>
<br>
For example, for <var>n</var> = 35, we have 4 different combinations of (<var>a, b, c, d</var>): (<var>8, 9, 9, 9</var>), (<var>9, 8, 9, 9</var>), (<var>9, 9, 8, 9</var>), and (<var>9, 9, 9, 8</var>).
</p>
<H2>Input</H2>
<p>
The input consists of several datasets. Each dataset consists of <var>n</var> (1 ≤ <var>n</var> ≤ 50) in a line. The number of datasets is less than or equal to 50.
</p>
<H2>Output</H2>
<p>
Print the number of combination in a line.
</p>
<H2>Sample Input</H2>
<pre>
35
1
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
4
</pre>
|
s031523254 | p00009 | Wrong Answer | import sys
from math import floor, sqrt
from bisect import bisect_right
primes = [2]
def isPrime(v):
threshold = floor(sqrt(v))
for p in primes:
if p > threshold:
break
if v % p == 0:
return False
return True
for v in range(3, 1000000, 2):
if isPrime(v):
primes.append(v)
print(len(primes))
values = []
for line in sys.stdin:
values.append(int(line))
for v in values:
print(bisect_right(primes, v))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s896963707 | p00009 | Wrong Answer | prime=[2]
for i in range(3,100,2):
primeq=True
for p in prime:
if i%p==0:
primeq=False
break
if i<p*p:break
if primeq:prime.append(i)
while True:
try:
n=int(input())
ans=0
for p in prime:
if p>n:break
ans+=1
print(ans)
except:break
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s472521075 | p00009 | Wrong Answer | numlist=[0,1]+[0]*999998
for i in range(3,1000000,2):
numlist[i]=1
for i in range(3,1000,2):
if numlist[i]==1:
for j in range(i*i,1000000,i):
numlist[j]=0
cnt=[0]*1000001
count=0
for i in range(1,1000000,2):
if numlist[i]:
count+=1
cnt[i]=cnt[i+1]=count
while True:
try:
n=int(input())
print(cnt[n])
except:
break
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s728740734 | p00009 | Wrong Answer | try:
while True:
n = int(input())
datasets = list(range(2, n+1))
answers = set([])
while datasets:
i = datasets[0]
datasets = filter(lambda data: data%i != 0, datasets)
answers.add(i)
print(len(answers))
except:
pass | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s210442744 | p00009 | Wrong Answer | # AOJ 0009
import sys
ps = [0]*10**6
used = [False]*10**6
p = 0
def sieve():
global p
used[0] = used[1] = True
for i in xrange(0,10**6):
if not used[i]:
ps[p] = i
p+=1
for j in xrange(i,10**6,i):
used[j] = True
def lower_bound(x):
lb = 0
ub = p+1
while ub-lb > 1:
mid = lb+ub>>1
if ps[mid] > x:
ub = mid
else:
lb = mid
return lb
sieve()
for i in sys.stdin:
print lower_bound(int(i))+1 | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s999100620 | p00009 | Wrong Answer | # AOJ 0009
import sys
ps = [0]*10**6
used = [False]*10**6
p = 0
def sieve():
global p
used[0] = used[1] = True
for i in xrange(0,10**6):
if not used[i]:
ps[p] = i
p+=1
for j in xrange(i,10**6,i):
used[j] = True
def lower_bound(x):
lb = 0
ub = p
while ub-lb > 1:
mid = lb+ub>>1
if ps[mid] > x:
ub = mid
else:
lb = mid
return lb
sieve()
for i in sys.stdin:
print lower_bound(int(i))+1 | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s374061773 | p00009 | Wrong Answer | # AOJ 0009
import sys
ps = [0]*10**6
used = [False]*10**6
p = 0
def sieve():
global p
used[0] = used[1] = True
for i in xrange(0,10**6):
if not used[i]:
ps[p] = i
p+=1
for j in xrange(i,10**6,i):
used[j] = True
def upper_bound(x):
lb = 0
ub = p
while ub-lb > 1:
mid = lb+ub>>1
if ps[mid] <= x:
lb = mid
else:
ub = mid
return ub
sieve()
for i in sys.stdin:
print upper_bound(int(i)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s186752182 | p00009 | Wrong Answer | import math
def lb(a,x):
l=0
r=len(a)-1
while l<r:
mid=int((l+r)/2)
#print "l=",l,' r=',r
if a[mid]<x:
l=mid+1
else:
r=mid
return l
maxn=1000001
a=[False for i in xrange(maxn)]
for i in xrange(2,int(math.sqrt(maxn))):
for j in xrange(i+i,maxn,i):
a[j]=True
b=[]
for i in xrange(2,maxn):
if not a[i]:
b.append(i)
while True:
try:
n=input()
f=lb(b,n)
if b[f]==n:
print(f+1)
else:
print(f)
except EOFError: break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s162306094 | p00009 | Wrong Answer | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def calc_prime(n):
p_list = [True]*n
p_list[0] = p_list[1] = False
for i in xrange(2,int(n**0.5)+1):
if p_list[i]:
for j in xrange(i*i,n,i):
p_list[j] = False
return [ i for i in xrange(2,n) if p_list[i] ]
prime_list = calc_prime(99999)
for s in sys.stdin:
d = int(s)
print len([1 for i in range(len(prime_list)) if prime_list[i] < d ]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s992888298 | p00009 | Wrong Answer | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def calc_prime(n):
p_list = [True]*n
p_list[0] = p_list[1] = False
for i in xrange(2,int(n**0.5)+1):
if p_list[i]:
for j in xrange(i*i,n,i):
p_list[j] = False
return [ i for i in xrange(2,n) if p_list[i] ]
prime_list = calc_prime(99999)
for s in sys.stdin:
d = int(s)
print len([prime_list[i] for i in range(len(prime_list)) if prime_list[i] <= d ]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s068266620 | p00009 | Wrong Answer | import sys
n_list = map(int, sys.stdin.readlines())
n_max = max(n_list)
pn_candidates = [0] + [1] * (n_max - 1)
pn = 2
while pn < n_max:
if pn_candidates[pn - 1] != 1:
pn += 1
continue
i = 2
while pn * i < n_max:
pn_candidates[pn * i - 1] = 0
i += 1
pn += 1
for n in n_list:
print sum(pn_candidates[:n]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s449200475 | p00009 | Wrong Answer | n = []
while True:
try:n.append(int(raw_input()))
except:break
R = max(n)+1
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0 for i in range(4,R,2)]
for i in range(3,int(R**0.5)+1,2):
if p[i]:
p[2*i::i] = [0]*len(p[2*i::i])
print p
for i in n:
print sum(p[:i+1]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s269833484 | p00009 | Wrong Answer | R = 1000000
p = [1]*R
p[0] = p[1] = 0
p[2] = 1
p[4::2] = [0 for i in range(4,R,2)]
idx = 2
for i in range(3,int(R**0.5)+1,2):
if p[i]:
p[i] = idx
idx += 1
p[2*i::i] = [0]*len(p[2*i::i])
while True:
try:print p[int(raw_input())+1]
except:break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s701157680 | p00009 | Wrong Answer | R = 1000000
p = [1]*R
p[0] = p[1] = 0
p[2] = 1
p[4::2] = [0 for i in range(4,R,2)]
idx = 2
for i in range(3,int(R**0.5)+1,2):
if p[i]:
p[i] = idx
idx += 1
p[2*i::i] = [0]*len(p[2*i::i])
while True:
try:print p[int(raw_input())]
except:break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s901144917 | p00009 | Wrong Answer | # -*- coding;utf-8 -*-
def sieve(n):
p = 0
primes = []
is_prime = [True]*(n+1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, n+1):
if(is_prime[i]):
primes.append(i)
p += 1
for j in range(i*2,n,i):#iごとに増える
is_prime[j] = False
return p
if(__name__ == "__main__"):
while(True):
try:
n = int(input())
except:
break
print(sieve(n))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s735755817 | p00009 | Wrong Answer | import math as m
n=int(input())
a=[0]*(n+1)
a[0],a[1]=1,1
for i in range(2,int(m.sqrt(n))+1):
for j in range(2,int(n/i)+1):
a[i*j]=1
print(a.count(0)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s620183289 | p00009 | Wrong Answer | while True:
try:
n=int(input())
a=[True]*(n+1)
a[0]=a[1]=False
for i in range(2,int(n**0.5)+1):
if a[i]:
for j in range(i**2,n,i):
a[j]=False
print(a.count(True))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s254136033 | p00009 | Wrong Answer | import sys
n=999999
prime = [1]*(n+1)
(prime[0],prime[1])=(0,0)
for i in xrange(2,n+1):
if type(i*i)==int:
for j in xrange(i*i,n+1,i):
prime[j]=0
for inp in [100]:
print prime[:inp-1].count(1) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s552291661 | p00009 | Wrong Answer | import sys
n=999999
prime = [1]*(n+1)
(prime[0],prime[1])=(0,0)
for i in [v for v in xrange(2,n+1) if v*v<n+1]:
for j in xrange(i*i,n+1,i):
prime[j]=0
for inp in sys.stdin:
print prime[:int(inp)-1].count(1) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s880004885 | p00009 | Wrong Answer | apple = int(raw_input())
count = 0
for i in range(2,apple-1):
if apple%i == 0:
count+=1
print count | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s218602898 | p00009 | Wrong Answer | apple = int(raw_input())
count = 0
for i in range(2,apple+1):
for j in range(2,i+1):
if i%j == 0 and i != j:
break
elif i == j:
count+=1
print count | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s569389682 | p00009 | Wrong Answer | #coding: UTF-8
from bisect import bisect
# 指定した数以下の素数の個数を返却する
# 素数判定はエラストテネスのふるい
# 要素1000000のリスト(素数かどうかのリスト)を準備
max_number = 100
#max_number = 1000000
prime_flag_list = [True] * max_number
# 0、1は素数でない
prime_flag_list[0] = False
prime_flag_list[1] = False
# 2の倍数(2を除く)は素数でない
prime_flag_list[4::2] = [False] * len(prime_flag_list[4::2])
# 3以上の数について、素数ならその倍数を振るい落とす
for i in range(3, int(max_number**0.5) + 1, 2):
prime_flag_list[i*i::i] = [False] * len(prime_flag_list[i*i::i])
# フラグの立ったままの箇所は素数なので、そこだけ取り出す
prime_list = [i for i in range(2, max_number) if prime_flag_list[i]]
while True:
try:
input = int(raw_input())
except EOFError:
break
for i in range(0, len(prime_list)):
if prime_list[i] > input:
print i
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s472880567 | p00009 | Wrong Answer | max_num = 1000000
cnt = 0
p = [1] * max_num
p[0] = p[1] = 0
for i in xrange(2, int(max_num ** 0.5) + 1):
if p[i]:
p[i * i::i] = [0] * len(p[i * i::i])
cnt += 1
p[i] = cnt
while True:
try: print(p[input()])
except: break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s973743002 | p00009 | Wrong Answer | max_num = 1000000
cnt = 0
p = [1] * max_num
p[0] = p[1] = 0
for i in xrange(2, int(max_num ** 0.5) + 1):
if p[i]:
p[i * i::i] = [0] * len(p[i * i::i])
cnt += 1
p[i] = cnt
while True:
try: print(p[int(raw_input())])
except: break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s920244731 | p00009 | Wrong Answer | def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
l = []
while True:
try:
n = int(raw_input())
except:
break
c = 0
for i in [2] + range(3, n+1, 2):
if is_prime(i):
c += 1
l.append(c)
for i in l:
print i | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s649369517 | p00009 | Wrong Answer | prime_num = 0
for i in range(int(raw_input())):
y = i+1
x = y / 2
while x > 1:
if y % x == 0:
break
x -= 1
else:
prime_num += 1
print(prime_num-1) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s167190048 | p00009 | Wrong Answer | import sys
l = [True] * 100000
for i in range(2, 100000):
if (l[i - 1]):
for j in range(i ** 2 - 1, 100000, i):
l[j] = False
for n in sys.stdin:
print(l[1:int(n)].count(True)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s027566830 | p00009 | Wrong Answer | import sys
l = [True] * 100000
for i in range(2, 100000):
if (l[i - 1]):
for j in range(i ** 2 - 1, 100000, i):
l[j] = False
for n in sys.stdin.readlines():
print(l[1:int(n)].count(True)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s930571116 | p00009 | Wrong Answer | import sys
l = [True] * 100000
for i in range(2, 100000):
if (l[i - 1]):
for j in range(i ** 2 - 1, 100000, i):
l[j] = False
n = [int(line) for line in sys.stdin]
for j in n:
print(l[1:int(j)].count(True)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s416612213 | p00009 | Wrong Answer | l = [True] * 100000
for i in range(2, 100000):
if (l[i - 1]):
for j in range(i ** 2 - 1, 100000, i):
l[j] = False
while True:
try:
n = int(input())
print(l[1:n].count(True))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s054007137 | p00009 | Wrong Answer | import math
num_max = 999999
i = 3
prime_list = [2]
while i<num_max :
judge = True
j = 0
while prime_list[j] <= math.sqrt(i) :
if (i%prime_list[j]==0) :
judge = False
break
j += 1
if(judge) :
prime_list.append(i)
i += 2
for i in range(30) :
try:
n = input()
k = 0
while prime_list[k] <= n :
k += 1
print(k)
except :
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s036198067 | p00009 | Wrong Answer | import math
num_max = 999999
i = 3
prime_list = [2]
while i<num_max :
judge = True
j = 0
while prime_list[j] <= math.sqrt(i) :
if (i%prime_list[j]==0) :
judge = False
break
j += 1
if(judge) :
prime_list.append(i)
i += 2
n = input()
k = 0
while prime_list[k] <= n :
k += 1
print(k) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s499918196 | p00009 | Wrong Answer | def main():
List=[]
while True:
try:
IN=int(input())
for i in range(2,IN+1):
List.append(i)
j=0
while (j+1)<=len(List):
l=len(List)
for k in range(l-1,j,-1):
a=List[k]%List[j]
if a==0:
del List[k]
else:
pass
j+=1
print(len(List))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s222437675 | p00009 | Wrong Answer | # -*- coding:utf-8 -*-
def main():
List=[]
while True:
try:
IN=int(input())
for i in range(2,IN+1):
List.append(i)
j=0
while (j+1)<len(List):
l=len(List)
for k in range(l-1,j,-1):
a=List[k]%List[j]
if a==0:
del List[k]
else:
pass
j+=1
print(len(List))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s665620281 | p00009 | Wrong Answer | import sys
import math
primes = [2,3,5]
for i in range(6,10000):
flg = True
for j in primes:
if i % j == 0:
flg = False
if flg:
primes.append(i)
while True:
try:
n = (int)(input())
l = 0
r = len(primes)
while r - l > 1:
m = (int)( (l+r)/2 )
if primes[m] >= n:
r = m
else:
l = m
print(r)
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s821409685 | p00009 | Wrong Answer | import sys
import math
primes = [2,3,5]
for i in range(6,1000):
flg = True
for j in primes:
if i % j == 0:
flg = False
if flg:
primes.append(i)
while True:
try:
n = (int)(input())
l = 0
r = len(primes)
while r - l > 1:
m = (int)( (l+r)/2 )
if primes[m] > n:
r = m
else:
l = m
print(r)
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s478674357 | p00009 | Wrong Answer | LIMIT = 10000000
isPrime = [True for _ in range(LIMIT)]
isPrime[0] = isPrime[1] = False
for i in range(2, int(LIMIT ** 0.5)+1):
if isPrime[i]:
for j in range(i * i, LIMIT, i):
isPrime[j] = False
try:
while True:
n = int(input())
count = 1 if isPrime[2] else 0
for i in range(3, n+1, 2):
if isPrime[i]:
count += 1
print(count)
except EOFError:
pass | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s226900109 | p00009 | Wrong Answer | def isprime(num):
i = 2
count = 0
while i< num:
if num % i == 0:
count += 1
i += 1
if count == 0:
return 1
else:
return 0
num = int(input())
count_prime = 0
for i in range(2,num):
if(isprime(i) == 1):
count_prime += 1
print(count_prime) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s664406045 | p00009 | Wrong Answer | import sys
from math import sqrt, floor
def is_prime(n):
for i in range(3, floor(sqrt(n)) + 1, 2):
if not n % i:
return False
return True
def count_prime(input_list):
count = max(input_list) > 1
inset = sorted((n, i) for i, n in enumerate(input_list))
i = 3
for t in inset:
t0 = t[0]
while i <= t0:
count += is_prime(i)
i += 2
yield (t[1], str(count))
print('\n'.join(t[1] for t in sorted(count_prime(list(map(int, sys.stdin)))))) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s641820665 | p00009 | Wrong Answer | import sys
from math import sqrt, floor
def is_prime(n):
for i in range(3, floor(sqrt(n)) + 1, 2):
if not n % i:
return False
return True
def count_prime(input_list):
count = int(max(input_list) > 1)
inset = sorted((n, i) for i, n in enumerate(input_list))
i = 3
for t in inset:
t0 = t[0]
while i <= t0:
count += is_prime(i)
i += 2
yield (t[1], str(count))
print('\n'.join(t[1] for t in sorted(count_prime(list(map(int, sys.stdin)))))) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s694889816 | p00009 | Wrong Answer | import sys
from math import sqrt, floor
def is_prime(n):
for i in range(3, floor(sqrt(n)) + 1, 2):
if not n % i:
return False
return True
def count_prime(input_list):
count = int(max(input_list) > 1)
inset = sorted((n, i) for i, n in enumerate(input_list))
i = 3
for t in inset:
t0 = t[0]
while i <= t0:
count += is_prime(i)
i += 2
yield (t[1], str(count))
for t in sorted(count_prime(list(map(int, sys.stdin)))):
print(t[1]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s342897409 | p00009 | Wrong Answer | # while True:
# try:
# data_set = map(int, raw_input().split())
# except EOFError:
# break
# count = 0
# a = data_set[0]
# b = data_set[1]
# sum = a + b
# while sum > 0:
# sum /= 10
# count += 1
# print count
from bisect import bisect
def sieve(n):
prime = [True] * n
prime[0] = prime[1] = False
for i in xrange(2, int(n ** 0.5) + 1):
if prime[i]:
for j in range(i ** 2, n, i):
prime[j] = False
return [i for x in xrange(2, n) if prime[i]]
primes = sieve(999999)
while True:
try:
print bisect(primes, input())
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s889008074 | p00009 | Wrong Answer | from bisect import bisect
def sieve(n):
prime = [True] * n
prime[0] = prime[1] = False
for i in xrange(2, int(n ** 0.5) + 1):
if prime[i]:
for j in range(i ** 2, n, i):
prime[j] = False
return [i for x in xrange(2, n) if prime[i]]
primes = sieve(999999)
while True:
try:
print bisect(primes, input())
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s357838046 | p00009 | Wrong Answer | #!/usr/bin/python
# import time
def sieve(n):
num = [1]*n
num[0] = num[1] = 0
for i in xrange(2,int(n**0.5)+1):
if num[i]:
for j in xrange(i**2, n, i):
num[j] = 0
return num.count(1)
# start = time.time()
hoge = sieve(999999)
# elapsed_time = time.time()-start
# print elapsed_time
print hoge | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s067045651 | p00009 | Wrong Answer | import sys
ary=[]
for i in sys.stdin:
ary.append(int(i))
m = max(ary)
prime=[1] * (m + 1)
prime[0] = prime[1] = 0
for i in range(2, int(m ** 0.5) + 1):
if prime[i] == 1:
for j in range(i*2, m + 1, i):
prime[j] = 0
for i in range(len(ary)):
print(sum(prime[:ary[i]])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s026281891 | p00009 | Wrong Answer | def mk_table(n):
res = [1] * (n + 1)
res[:2] = 0, 0
for i in range(2, n):
if i ** 2 > n:
break
if res[i] == 1:
for j in range(2, n // i + 1, i):
res[i * j] = 0
return res
tbl = mk_table(999999)
try:
while 1:
print(len([x for x in tbl[:int(input())+1] if x == 1]))
except Exception:
pass | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s664105021 | p00009 | Wrong Answer | def mk_table(n):
res = [1] * (n + 1)
res[:2] = 0, 0
for i in range(2, n):
if i ** 2 > n:
break
if res[i] == 1:
for j in range(i*2, n // i + 1, i):
res[j] = 0
return res
tbl = mk_table(999999)
try:
while 1:
print(len([x for x in tbl[:int(input())+1] if x == 1]))
except Exception:
pass | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s752523663 | p00009 | Wrong Answer | def Sieve(n):
prime_numbers=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,
59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,
131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,
211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,
293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,
389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,
479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,
587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,
673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,
773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,
881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,
991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,
1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,
1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,
1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,
1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,
1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,
1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,
1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,
1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,
1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,
2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,
2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,
2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,
2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,
2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,
2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,
2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,
2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,
3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,
3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,
3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,
3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,
3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,
3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,
3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,
3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,
4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,
4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,
4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,
4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,
4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,
4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,
4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,
4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,5021,5023,5039,5051,
5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,5167,5171,5179,5189,
5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297,5303,5309,5323,5333,
5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431,5437,5441,5443,5449,
5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531,5557,5563,5569,5573,
5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,5683,5689,5693,5701,
5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,5813,5821,5827,5839,
5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,5923,5927,5939,5953,
5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073,6079,6089,6091,6101,
6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203,6211,6217,6221,6229,
6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317,6323,6329,6337,6343,
6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,6451,6469,6473,6481,
6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,6599,6607,6619,6637,
6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,6733,6737,6761,6763,
6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857,6863,6869,6871,6883,
6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977,6983,6991,6997,7001,
7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121,7127,7129,7151,7159,
7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,7253,7283,7297,7307,
7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,7451,7457,7459,7477,
7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,7549,7559,7561,7573,
7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669,7673,7681,7687,7691,
7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793,7817,7823,7829,7841,
7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933,7937,7949,7951,7963,
7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,8093,8101,8111,8117,
8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,8233,8237,8243,8263,
8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,8369,8377,8387,8389,
8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521,8527,8537,8539,8543,
8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647,8663,8669,8677,8681,
8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753,8761,8779,8783,8803,
8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,8893,8923,8929,8933,
8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,9041,9043,9049,9059,
9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,9181,9187,9199,9203,
9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311,9319,9323,9337,9341,
9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431,9433,9437,9439,9461,
9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547,9551,9587,9601,9613,
9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697,9719,9721,9733,9739,
9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829,9833,9839,9851,9857,
9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949,9967,9973]
cnt=0
for i in prime_numbers:
if i<=n:
cnt+=1
else:
break
return cnt
while True:
try:
n=int(input())
print(Sieve(n))
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s203559942 | p00009 | Wrong Answer | a=int(input())
X=[i for i in range(2,a+1)]
Y=[]
while True:
X=[i for i in X if i % X[0] !=0 ]
if X == Y:
break
Y=X[:]
print(len(X))
| 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s612276855 | p00009 | Wrong Answer | import sys
for i in sys.stdin:
n = int(i)
arr = [i for i in range(0,n+1)]
for i in range(2, len(arr)):
if arr[i] != 0:
j = 2
while i*j <= n:
if arr[i*j] != 0:
arr[i*j] = 0
j += 1
primNum = 0
for i in arr:
if i > 1:
primNum += 1
print(primNum) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s711965774 | p00009 | Wrong Answer | A=[
960131, 960137, 960139, 960151, 960173, 960191, 960199, 960217, 960229, 960251, 960259, 960293, 960299, 960329, 960331, 960341, 960353, 960373, 960383, 960389, 960419, 960467, 960493, 960497, 960499, 960521, 960523, 960527, 960569, 960581, 960587, 960593, 960601, 960637, 960643, 960647, 960649, 960667, 960677, 960691, 960703, 960709, 960737, 960763, 960793, 960803, 960809, 960829, 960833, 960863, 960889, 960931, 960937, 960941, 960961, 960977, 960983, 960989, 960991, 961003, 961021, 961033, 961063, 961067, 961069, 961073, 999149, 999169, 999181, 999199, 999217, 999221, 999233, 999239, 999269, 999287, 999307, 999329, 999331, 999359, 999371, 999377, 999389, 999431, 999433, 999437, 999451, 999491, 999499, 999521, 999529, 999541, 999553, 999563, 999599, 999611, 999613, 999623, 999631, 999653, 999667, 999671, 999683, 999721, 999727, 999749, 999763, 999769, 999773, 999809, 999853, 999863, 999883, 999907, 999917, 999931, 999953, 999959, 999961, 999979, 999983]
while True:
try:
n=int(input())
print(A)
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s589710309 | p00009 | Wrong Answer | import sys,math
def is_prime_number(arg):
arg_sqrt=int(math.floor(math.sqrt(arg)))
i=2
while i <=arg_sqrt:
if arg %i ==0:
return False
i+=1
return True
n=0
prime_numbers=0
for line in sys.stdin:
l=int(line)
if n == 0:
n=l
continue
if is_prime_number(l):
prime_numbers+=1
print prime_numbers | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s308699487 | p00009 | Wrong Answer | # ?´???°?????°?????¨?????????????????°??????
import sys
import math
prim_no = {2: True} # ????????°????´???°??§??????????????????????????????
def is_prime(no):
if no == 2:
return True
if no % 2 == 0:
return False
if prim_no.get(no) is not None:
return prim_no.get(no)
max_check = int(math.sqrt(no))
for i in range(3, max_check+1, 2):
if no % i == 0:
prim_no[no] = False
return False
prim_no[no] = True
return True
def main():
prim_vals = {} # ????????°?????§????´???°????????°
while True:
num = sys.stdin.readline()
if num is None or num.strip() == '':
break
num = int(num.strip())
if prim_vals.get(num) is not None:
cnt = prim_vals.get(num)
else:
#print('num:', num)
if num == 1:
cnt = 0
else:
cnt = 0
#for i in range(3, num + 1, 2):
if num % 2 == 0:
start_num = num -1
else:
start_num = num
for i in range(start_num, 1, -2):
#print('i:', i)
if prim_vals.get(i) is not None:
cnt += prim_vals.get(i)
break
if is_prime(i):
cnt += 1
prim_vals[num] = cnt # ????????°?????§????´???°????????°????????????(2?????????)
cnt += 1 # 2??????????¶????
print(cnt)
if __name__ == '__main__':
main()
#print(prim_no) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s918723166 | p00009 | Wrong Answer | while True:
try:
n=int(input())
L=[i for i in range(n+1) if i==2 or (i>=3 and i%2==1)]
print(len(L))
except EOFError:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s264907148 | p00009 | Wrong Answer | import sys
p = [0] * 1000000
v = [0] * 1000000
for i in range(2, 1000000):
for n in range(i + i, 100000, i):
p[n] = True
v[i] = v[i - 1] + 1 if p[i] == False else v[i - 1]
for m in sys.stdin:
print(v[int(m.replace("\n", ""))]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s578364194 | p00009 | Wrong Answer | from math import sqrt
def eratosthenes(n):
def era(x,p):
if x<=p or (x>p and x%p!=0):
return x
else:
return None
A=[i for i in range(2,n+1)]
p=2
while p<=sqrt(n):
A=list(filter(lambda x:era(x,p),A))
p+=1
return(A)
print(eratosthenes(int(input()))) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s172399973 | p00009 | Wrong Answer | import math
import sys
a = [1]*1000000
a[0] = a[1] = 0
for i in range(2,int(math.sqrt(1000000))):
if a[i] == 1:
for j in range(i+i,1000000,i):
a[j] = 0
for i in range(1,1000000):
a[i] += a[i-1]
for line in sys.stdin:
print(a[int(input())]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s002157598 | p00009 | Wrong Answer | while True:
try:
n = int(input())
primes = [1 for _ in range(n+1)]
for i in range(4, n+1, 2):
primes[i] = 0
for i in range(6, n+1, 3):
primes[i] = 0
for i in range(10, n+1, 5):
primes[i] = 0
for i in range(14, n+1, 7):
primes[i] = 0
primes[0], primes[1] = 0, 0
print(sum(primes))
except:
break | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s175172178 | p00009 | Wrong Answer |
prime=[False]*1000000
for i in range(2,1001):
for j in range(i*2,1000000,i):
prime[j]=True
while True:
try:
n=int(input())
except:
break
print(prime[:n+1].count(False)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s777650719 | p00009 | Wrong Answer |
prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000):
if prime[i]:
for j in range(i*2,1000000,i):
prime[j]=False
np[i]=np[i-1]+prime[i]
while True:
try:
n=int(input())
except:
break
print(np[n]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s831476677 | p00009 | Wrong Answer | prime=[False]*1000000
np=[0]*1000000
for i in range(2,1000):
if not prime[i]:
for j in range(i*2,1000000,i):
prime[j]=True
while True:
try:
n=int(input())
except:
break
print(sum(prime[2:n+1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s140074204 | p00009 | Wrong Answer | import sys
import math
N = 1000000
primes = [1] * N
primes[0] = 0
primes[1] = 0
primes[4::2] = [0] * len(primes[4::2])
for i in range(3,int(math.sqrt(N)),2):
if primes[i]:
primes[i*i::i*2] = [0] * len(primes[i*i::i*2])
for i in sys.stdin:
n = int(i)
print(sum(primes[0:n])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s531164171 | p00009 | Wrong Answer | import sys
import math
N = 1000000
primes = [1] * (N//2)
primes[0] = 0
for i in range(3,int(math.sqrt(N)),2):
j = i//2
if primes[j]:
primes[i*j::i] = [0] * len(primes[i*j::i])
for i in sys.stdin:
n = int(i)
if n == 1:
print(0)
elif n == 2:
print(1)
else:
print(sum(primes[0:(n+1)//2])+1) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s360889537 | p00009 | Wrong Answer |
def isp(n):
a = 1
for i in range(2, (n + 1) // 2 + 2):
if not n % i:
a = 0
break
return a
num = int(input())
if num == 2:
print(1)
elif num == 3:
print(2)
else:
s = 2
for x in range(2, num + 1):
if isp(x):
s += 1
print(s) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s359450358 | p00009 | Wrong Answer | import sys
ary=[]
for i in sys.stdin:
ary.append(int(i))
def isp(n):
a = 1
for i in range(2, int(n ** 0.5) + 1):
if not n % i:
a = 0
break
return a
for i in ary:
s = 0
for i in range(2, 12):
if isp(i):
s += 1
print(s) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s179367245 | p00009 | Wrong Answer | import sys
def primes(n):
f = []
for i in range(n + 1):
if i > 2 and i % 2 == 0:
f.append(0)
else:
f.append(1)
i = 3
while i * i <= n:
if f[i] == 1:
j = i * i
while j <= n:
f[j] = 0
j += i + i
i += 2
return f[2:]
if __name__ == "__main__":
ps = primes(100)
for n in sys.stdin:
i = int(n)
print(i,sum(ps[:i-1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s915519284 | p00009 | Wrong Answer | import sys
def primes(n):
f = []
for i in range(n + 1):
if i > 2 and i % 2 == 0:
f.append(0)
else:
f.append(1)
i = 3
while i * i <= n:
if f[i] == 1:
j = i * i
while j <= n:
f[j] = 0
j += i + i
i += 2
return f[2:]
if __name__ == "__main__":
ps = primes(100)
for n in sys.stdin:
i = int(n)
if i < 2:
print(0)
break
print(i,sum(ps[:i-1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s725847097 | p00009 | Wrong Answer | import sys
def primes(n):
f = []
for i in range(n + 1):
if i > 2 and i % 2 == 0:
f.append(0)
else:
f.append(1)
i = 3
while i * i <= n:
if f[i] == 1:
j = i * i
while j <= n:
f[j] = 0
j += i + i
i += 2
return f[2:]
if __name__ == "__main__":
ps = primes(100)
for n in sys.stdin:
i = int(n)
if i < 2:
print(i, 0)
else:
print(i, sum(ps[:i - 1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s641509806 | p00009 | Wrong Answer | import sys
def primes(n):
f = []
for i in range(n + 1):
if i > 2 and i % 2 == 0:
f.append(0)
else:
f.append(1)
i = 3
while i * i <= n:
if f[i] == 1:
j = i * i
while j <= n:
f[j] = 0
j += i + i
i += 2
return f[2:]
if __name__ == "__main__":
ps = primes(100)
for n in sys.stdin:
i = int(n)
if i < 2:
print(0)
else:
print(sum(ps[:i - 1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s315549945 | p00009 | Wrong Answer | import sys
x = 1000000
xx = 500000
f = [1, 0] * xx
f[0] = 0
f[1] = 1 # [02305070...]12345
i = 3
while i < x:
if f[i] == 1:
j = i
y = x // i + 1
while j < y:
f[j] = 0
j += i + i
i += 2
for n in sys.stdin:
i = int(n)
if i < 2:
print(0)
else:
print(sum(f[:i - 1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s179773613 | p00009 | Wrong Answer | import sys
x = 1000000
xx = 500000
f = [1, 0] * xx
f[0] = 0
f[1] = 1
i = 3
while i < x:
if f[i] == 1:
j = i
y = x // i + 1
while j < y:
f[j] = 0
j += i + i
i += 2
for n in sys.stdin:
i = int(n)
if i < 2:
print(0)
else:
print(sum(f[:i])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s224266994 | p00009 | Wrong Answer | import sys
x = 1000000
xx = 500000
f = [1, 0] * xx
f[0] = 0
f[1] = 1
i = 3
while i < x:
if f[i] == 1:
j = i
y = x // i + 1
while j < y:
f[j] = 0
j += i + i
i += 2
for n in sys.stdin:
i = int(n)
print(sum(f[:i])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s016504420 | p00009 | Wrong Answer | import sys
lalala = 1000000//30 + 1
f = ([1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0]+[1,0]*7 ) * lalala
f = [0,0,1,1] + f[3:-20]
i = 2
while i < 1000:
if f[i] == 1:
j = i * i
while j <= 1000000:
f[j] = 0
j += i + i
i += 2
for n in sys.stdin:
i = int(n)
print(sum(f[:i + 1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s232565285 | p00009 | Wrong Answer | import sys
lalala = 1000000//30 + 1
f = ([1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0]+[1,0]*7 ) * lalala
f = [0,0,1,1] + f[3:-20]
i = 5
while i < 1000:
if f[i] == 1:
j = i * i
while j <= 1000000:
f[j] = 0
j += i + i
i += 2
for n in sys.stdin:
i = int(n)
print(sum(f[:i + 1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s994172939 | p00009 | Wrong Answer | from sys import stdin
for n in stdin:
print(int(n)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s859294809 | p00009 | Wrong Answer | import sys
prime = [2,3,5,7,11,13,19,23,29,31]
shieve1 = [1]*1001
for i in prime:
itr = i-1
while(itr<1000):
shieve1[itr] = 0
itr += i
for i in range(32,1000):
if shieve1[i]:
prime.append(i+1)
shieve2 = [1]*(10**6+1)
for i in prime:
itr = i-1
while(itr<10**6):
shieve2[itr] = 0
itr += i
for i in range(1001,10**6+1):
if shieve2[i]:
prime.append(i+1)
for line in sys.stdin:
n = int(line)
cont = 0
for i in prime:
if i<=n:
cont += 1
else:
break
print(cont) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s748468085 | p00009 | Wrong Answer | import sys
import math as mas
def sieve(n):
p=[True for i in range(n+1)]
p[0]=p[1]=False
end=int(n**0.5)
for i in range(2,end+1):
if p[i]:
for j in range(i*i,n+1,i):
p[j]=False
return p
sosu=sieve(1000010)
for i in sys.stdin:
print(sum(sosu[t] for t in range(int(i))))
# a,b=map(int,i.split())
# print(gcd(a,b),lcm(a,b)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s783313948 | p00009 | Wrong Answer | maxv = 0
primes = [0]*1000000
jk = True
def isPrime(x):
if x == 2:
return True
if x < 2 or x % 2 == 0:
return False
i, root_x = 3, int(pow(x, 0.5))
while i <= root_x:
if x % i == 0:
return False
i += 2
return True
while True:
try:
n = int(input())
except:
break
tmp = max(n, maxv)
if jk:
for i in range(2, n+1):
if isPrime(i): primes[i] = 1
jk = False
maxv = max(n, maxv)
else:
if maxv != tmp:
maxv = tmp
for i in range(n, maxv+1):
if isPrime(i): primes[i] = 1
print(sum([1 for i in range(n+1) if primes[i] == 1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s406646513 | p00009 | Wrong Answer | list = 1000000 *[1]
list[0] = 0
list[1] = 0
for i in range(1,1000000):
if list[i] == 1:
for j in range(i*i,1000000,i):
list[j] = 0
for i in range(2,1000000):
list[i] += list[i-1]
n = int(input())
print list[n] | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s882194412 | p00009 | Wrong Answer | list = 1000000 *[1]
list[0] = 0
list[1] = 0
for i in range(1,1000000):
if list[i] == 1:
for j in range(i*i,1000000,i):
list[j] = 0
for i in range(2,1000000):
list[i] += list[i-1]
n = int(input())
print int(list[n]) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s904339903 | p00009 | Wrong Answer | from math import sqrt,floor
from sys import stdin
def cntPrime(n):
mx = sqrt(n) + 1
if n % 2 == 0:
l = [0, 1] + [1, 0] * (int(n/2) - 1)
else:
l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
c = 3
while c < mx:
for k in range(c, floor(n/c) + 1, 1):
l[c * k -1] = 0
c = l[:c].index(1) + c
while c % 2 == 0 or (c > 5 and c % 5 == 0):
c = l[:c].index(1) + c
return sum(l)
for n in stdin:
n = int(n)
print(cntPrime(n)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s274739584 | p00009 | Wrong Answer | from math import sqrt,floor
from sys import stdin
def cntPrime(n):
mx = sqrt(n) + 1
if n % 2 == 0:
l = [0, 1] + [1, 0] * (int(n/2) - 1)
else:
l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
c = 3
while c < mx:
for k in range(c*2, n+1, c):
l[k-1] = 0
c = l[:c].index(1) + c
while c % 2 == 0:
c = l[:c].index(1) + c
return sum(l)
for n in stdin:
n = int(n)
print(cntPrime(n)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s516299104 | p00009 | Wrong Answer | from math import sqrt,floor
from sys import stdin
def cntPrime(n):
mx = sqrt(n)
if n % 2 == 0:
l = [0, 1] + [1, 0] * (int(n/2) - 1)
else:
l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
c = 3
while c < mx:
for k in range(c*2, n+1, c):
l[k-1] = 0
c = l[(c+1):].index(1) + c +2
while c % 2 == 0:
c = l[(c+1):].index(1) + c +2
return l
t = cntPrime(1000000)
for n in stdin:
n = int(n)
print(sum(t[:n-1])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s307717243 | p00009 | Wrong Answer | from sys import stdin
for Input in stdin :
Input = int(Input)
if (Input <= 10) :
if (Input <= 1) : print(0)
elif (Input == 2) : print(1)
elif (Input == 3) or (Input == 4) : print(2)
elif (Input == 5) or (Input == 6) : print(3)
else : print(4)
else :
result = 4
for make in range(11, Input + 1, 2) :
if (make % 2 != 0) or (make % 3 != 0) or (make % 5 != 0) or (make % 7 != 0) : result += 1
print(result) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s066236387 | p00009 | Wrong Answer | from sys import stdin
for Input in stdin :
Input = int(Input)
if (Input <= 10) :
if (Input <= 1) : print(0)
elif (Input == 2) : print(1)
elif (Input == 3) or (Input == 4) : print(2)
elif (Input == 5) or (Input == 6) : print(3)
else : print(4)
else :
result = 4
for make in range(11, Input + 1, 2) :
if (make % 2 != 0) and (make % 3 != 0) and (make % 5 != 0) and (make % 7 != 0) : result += 1
print(result) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s229321432 | p00009 | Wrong Answer | import sys
def check(q):
if q == 2: return True
if q&1 == 0: return False
return pow(2, q-1, q) == 1
l = [d for d in range(2, 1000000) if check(d)]
for line in sys.stdin:
N = int(line.rstrip())
print(len([i for i in l if N>i])) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
s053804000 | p00009 | Wrong Answer | n=int (input())
li=[]
for i in range(2,n+1):
for j in range(2,i):
if i%j==0:
break
else:
li.append(i)
print(len(li)) | 10
3
11
| 4
2
5
|
<H1>Prime Number</H1>
<p>
Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset has an integer <var>n</var> (1 ≤ <var>n</var> ≤ 999,999) in a line.
</p>
<p>
The number of datasets is less than or equal to 30.
</p>
<H2>Output</H2>
<p>
For each dataset, prints the number of prime numbers.
</p>
<H2>Sample Input</H2>
<pre>
10
3
11
</pre>
<H2>Output for the Sample Input</H2>
<pre>
4
2
5
</pre>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.