Problem:


Score: 200 points

Problem Statement

The number 105 is quite special - it is odd but still it has eight divisors.
Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?

Constraints

N is an integer between 1 and 200 (inclusive).

Input

Input is given from Standard Input in the following format:

N

Output

Print the count.

Sample Input 1

105

Sample Output 1

1

Among the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.

Sample Input 2

7

Sample Output 2

0

1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.



Sample input:
105


Sample output:
1

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for j in range(1,n+1,2):
    count=0
    for i in range(1,j+1):
        if j%i==0:
            count+=1
    if count==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

#[105,135,165,189,195]

if n<105: print(0)
elif n<135: print(1)
elif n<165: print(2)
elif n<189: print(3)
elif n<195: print(4)
else: print(5)

Submission status: Accepted

Solution code:
def divisor(n):
    lists=[]
    for i in range(1,n+1):
        if n%i==0:
            lists.append(i)
    return len(lists)

N=int(input())
cnt=0
for i in range(1,N+1):
    if i%2 != 0 and divisor(i)==8:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
nl = map(int, (i for i in range(1, n + 1, 2)))
ans = 0


def eight(num):
    i = 1
    cnt = 0
    while i <= num:
        if num % i == 0:
            cnt += 1
        i += 1
    if cnt == 8:
        return 1
    else:
        return 0


for i in nl:
    ans += eight(i)

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt

n = int(input())

ans = 0
for i in range(1,n+1):
    count = 1
    if i % 2 == 0:
        continue
    for k in range(1,i):
        if i % k == 0:
            count += 1
    if count == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans = 0
for i in range(1,N+1,2):
  nn = i
  c = 0
  s = 1
  d = []
  while s*s <= i:
    if nn%s == 0:
      d.append(s)
      c += 1
      if nn != s:
        d.append(nn//s)
        c += 1
    s += 1
  if c == 8:
    ans += 1
#    print(i,d)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def divisible_count(n):
    result = 0
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            result += 1
            if i != n // i:
                result += 1
    return result


def main():
    N = int(input())
    print(sum(divisible_count(x) == 8 for x in range(1, N + 1, 2)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
l = []
for i in range(1, N + 1, 2):
  count = 0
  for j in range(1, i + 1, 2):
    if i % j == 0:
      count += 1
  if count == 8:
    l.append(i)
print(len(l))

Submission status: Accepted

Solution code:
N = int(input())
answer = 0
for i in range(1,N+1,2):
    div = []
    for j in range(1,N+1):
        if i%j==0:
            div.append(j)
    if len(div)==8:
        answer += 1
print(answer)

Submission status: Accepted

Solution code:
N = int(input())
result = 0
for i in range(1,N+1,2):
  #print(i)
  A = 0
  for j in range(1,i+1):
    #print(j)
    if i % j == 0:
      A += 1
  if A == 8:
    result += 1
print(result)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1, N+1, 2):
    cnt = 0
    for j in range(1, i+1):
        if i%j == 0:
            cnt += 1
        else:
            cnt = cnt
    if cnt == 8:
        ans += 1
    else:
        ans = ans

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
cnt=0
L=[3*5*7,3*5*9,3*5*11,3*5*13,3*7*9]
for l in L:
  cnt+=(l<=N)
print(cnt)

Submission status: Accepted

Solution code:
def main():
    limit = int(input())
    result = 0
    for i in range(1, limit + 1, 2):
        divisor = 2
        j = 2
        while j * j <= i:
            if i % j == 0:
                if i * i == j:
                    divisor += 1
                else:
                    divisor += 2
            j += 1
        if divisor == 8:
            result += 1
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
usrInput = int(input())
kosuu = []

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

for n in range(usrInput):
    counting = n + 1
    divisors = make_divisors(counting)
    if len(divisors) == 8 and counting % 2 == 1:
        kosuu.append(counting)

print(len(kosuu))

Submission status: Accepted

Solution code:
num = int(input())

# Order 40000 / approve
ct = 0

for i in range(105,num + 1,2):
    i_primes = 0
    for j in range(1, i + 1):
        if i % j == 0:
            if (i // j) <= j:
                break
            i_primes += 2
    
    ct += 1 if i_primes == 8 else 0

print(ct)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1,n + 1):
    cnt = 0
    if i % 2 == 1:
        for j in range(1,i + 1):
            if i % j == 0:
                cnt += 1
        if cnt == 8:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())

def factors(a):
    b = int(math.sqrt(a))
    f = []
    for i in range(1, b+1):
        if a % i == 0:
            f.append(i)
            f.append(a//i)
    return len(f)

def solve():
    if n < 105:
        print(0)
        return
    ans = 0
    for i in range(105, n+1, 2):
        if factors(i) == 8:
           ans += 1
    print(ans)
solve()

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
ans=0
N=int(input())
if N<105:
    print(0)
    exit(0)
for i in range(104,N+1):
    if i%2==1 and len(make_divisors(i))==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n + 1, 2):
  div_count = 0
  for j in range(1, i + 1):
    if i % j == 0:
      div_count += 1
  if div_count == 8:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = []
for i in range(1, n + 1):
  temp = []
  for j in range(1, i + 1, 2):
    if i % j == 0:
      temp.append(j)
  if len(temp) == 8:
    ans.append(i)
    
print(len(ans))

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
for i in range(1,n+1,2):
	a=0
	for j in range(1,i+1):
		if i  % j ==0:
			a += 1
	if a==8:
		cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
p=[3,5,7,11,13]
x=[]
for i in range(5):
	for j in range(i):
		for k in range(j):
			if n >= p[i]*p[j]*p[k]:
				x.append(i*j*k)
cnt=len(x)
if 135 <= n < 189:
	cnt += 1
elif 189 <= n:
	cnt += 2
else:
	pass
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1,n+1,2):
    x = 0
    
    for j in range(1,i+1):
        if i % j == 0:
            x += 1
       
    if x == 8:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
#A = list(map(int, input().split()))
N = int(input())
ans = 0
if N>=195:
    ans = 5
elif N>=189:
    ans = 4
elif N>=165:
    ans = 3
elif N>=135:
    ans = 2
elif N>=105:
    ans = 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

def div(n):
    table=[]
    for i in range(1,int(n**0.5)+1):
        if i*i>n:
            break
        if n%i==0:
            table.append(i)
            if n//i!=i:
                table.append(n//i)
    return table

ans=0
for i in range(1,N+1,2):
    if len(div(i))==8:
        ans+=1
        
print(ans)

Submission status: Accepted

Solution code:
# 約20分
# 簡単な問題なのだがパッと正確にイメージできていない

n = int(input())
l = []
for j in range(1,n+1):
    if j%2 != 0:
        l.append(j)
b = 0
for i in l:
    a = 0
    for k in range(1,i+1):
        if i%k == 0:
            a += 1
    if a == 8:
        b += 1
print(b)

Submission status: Accepted

Solution code:
n = int(input())
l = []
for j in range(1,n+1):
    if j%2 != 0:
        l.append(j)
b = 0
for i in l:
    a = 0
    for k in range(1,i+1):
        if i%k == 0:
            a += 1
    if a == 8:
        b += 1
print(b)

Submission status: Accepted

Solution code:
# 3*5*7=105, 3*5*11=165, 3*5*13=195, 3^3*5=135, 3^3*7=189
n=int(input())
if n<105:
  print(0)
elif n<135:
  print(1)
elif n<165:
  print(2)
elif n<189:
  print(3)
elif n<195:
  print(4)
else:
  print(5)

Submission status: Accepted

Solution code:
n = int(input())

s = 0

for i in range(1,n+1,2):
  count = 0
  for j in range(1,n+1):
    if i%j == 0:
        count = count + 1
  if count == 8:
    s += 1
    
print(s)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
l=[i for i in range(1,n+1) if i%2==1]
for i in l:
    cnt=0
    for j in range(1,i+1):
        if i%j==0:
            cnt+=1
    if cnt==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
c=0
for i in range(1,n+1):
  if i%2==0:
    pass
  else:
    t=0
    for j in range(1,i+1):
      if i%j==0:
        t+=1
      if t==8:
        c+=1
print(c)

Submission status: Accepted

Solution code:
N = int(input())

ans = []
for n in range(1, N+1, 2):
    d = 0
    for i in range(1, n+1):
        if n % i == 0:
            d += 1
    if d == 8:
        ans.append(n)

print(len(ans))

Submission status: Accepted

Solution code:
N = int(input())

def divisorChecker(N):
    cnt = 0
    for i in range(1,N +1):
        if N % i == 0:
            cnt += 1
    return cnt

output = 0
for i in range(1, N +1, 2):
    div_cnt = divisorChecker(i)
    if div_cnt == 8:
        output += 1
        
print(output)

Submission status: Accepted

Solution code:
n=int(input())
sa=0
for i in range(1,n+1):
    ans=0
    for j in range(1,i):
        if i%j==0:
            ans+=1
    if ans==7 and i%2==1:
        sa+=1
print(sa)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

for i in range(1, n+1, 2):
    cnt = 0
    for j in range(1, n+1):
        if(i % j == 0):
            cnt += 1
    if(cnt == 8):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def F(n):
    count = 0
    for i in range(1, n+1):
        if n % i == 0 :
            count += 1
    return count

ans = 0 

for i in range(1, n+1, 2):
    if F(i) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(N + 1):
    if i % 2 == 0:
        continue
    c = 0
    for j in range(1, i + 1):
        if i % j == 0:
            c += 1
    if c == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
i=int(input())
if i<105:print(0)
if i<135 and i>=105:print(1)
if i<165 and i>=135:print(2)
if i<189 and i>=165:print(3)
if i<195 and i>=189:print(4)
if i>=195:print(5)

Submission status: Accepted

Solution code:
n = int(input())

def divisor(n: int) -> list:
    list_of_divisor = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            list_of_divisor.append(i)
            if i != n//i:
                list_of_divisor.append(n//i)
    # list_of_divisor.sort()
    return list_of_divisor

ans = 0
for i in range(1, n+1, 2):
    li = divisor(i)
    if len(li) == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
c = 0
ans = 0

for i in range(1,n+1,2):
	for j in range(1,i+1):
		if i % j == 0:
			c += 1
	if c == 8:
		ans += 1
	c = 0

print(ans)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())
ans = 0

for i in range(1,n+1,2):
    if len(make_divisors(i)) == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)

    return divisors
ans = 0
for i in range(N):
    if (i+1)%2==1:
        d = make_divisors(i+1)
        if len(d) == 8:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
s = 0
for i in range(N+1):
  if i % 2 == 1:
    t = 0
    for j in range(1,i+1):
      if i % j == 0:
        t += 1
    if t == 8:
      s += 1
print(s)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n+1):
    l = [] 
    for j in range(1, i+1):
        if i % j == 0:
            l.append(j)

    if len(l) == 8 and i % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
list=[]
for i in range(1,n+1,2):
	count=0
	for j in range(1,i+1,1):
		if i%j==0:
			count+=1
	if count==8:
		list.append(i)
print(len(list))

Submission status: Accepted

Solution code:
n=int(input())
ans=0

for i in range(1,n+1,2):
  cnt=0
  for j in range(1,i+1):
    if i%j==0:
      cnt+=1
  ans+=(1 if cnt==8 else 0)

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
num=0
cdcount=0
count=0
for i in range(N):
    num=i+1
    for j in range(num):
        if (num%(j+1)==0):
            cdcount=cdcount+1
    if (cdcount==8)and(num%2==1):
        count=count+1
    cdcount=0
print(count)

Submission status: Accepted

Solution code:
n = int(input())
lp = [3,5,7,11,13]

ans = 0
for i in (range(n)):
  li = []
  for k in lp:
    tmp = i+1
    cnt = 0
    while tmp%k == 0:
      tmp //= k
      cnt += 1
    if cnt > 0:
      li.append(cnt)
  if li in [[1,1,1], [3,1]]:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lp = []
for i in range(3,int(n//2)+1):
  for k in lp:
    if i%2 == 0 or i%k == 0:
      break
  else:
    lp.append(i)

ans = 0
for i in (range(n)):
  li = []
  for k in lp:
    tmp = i+1
    cnt = 0
    while tmp%k == 0:
      tmp //= k
      cnt += 1
    if cnt > 0:
      li.append(cnt)
  if li in [[1,1,1], [1,3], [3,1], [7]]:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lp = []
for i in range(3,int(n**0.5)+1):
  for k in lp:
    if i%2 == 0 or i%k == 0:
      break
  else:
    lp.append(i)

ans = 0
for i in (range(n)):
  li = []
  for k in lp:
    tmp = i+1
    cnt = 0
    while tmp%k == 0:
      tmp //= k
      cnt += 1
    if cnt > 0:
      li.append(cnt)
  if li in [[1,1,1], [1,3], [3,1], [7]]:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = [105,135,165,189,195]

if a[0] > n: print(0)
elif a[0] <= n < a[1]: print(1)
elif a[1] <= n < a[2]: print(2)
elif a[2] <= n < a[3]: print(3)
elif a[3] <= n < a[4]: print(4)
elif a[4] <= n: print(5)

Submission status: Accepted

Solution code:
from math import floor, sqrt
N = int(input())
ans = 0
for o in range(1, N + 1, 2):
  cnt = 0
  for n in range(1, o + 1):
    if o % n == 0:
      cnt += 1
  if cnt == 8:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n+1):
  if i%2==0:
    continue
  temp = 0
  for j in range(1,i+1):
    if i%j==0:
      temp += 1
  if temp==8:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import math
ans = 0
n = int(input())
for i in range(1,n+1,2):
    count = 0
    for j in range(1,int(math.sqrt(i))+1):
        if i%j==0:
            count+=1
    if count*2 == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1,n+1,2):
  cnt=0
  for j in range(1,i+1):
    if i%j==0:
      cnt+=1
  if cnt==8:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
count1 = 0

for i in range(1, n + 1, 2):
    count2 = 0

    for j in range(1, i + 1):
        if i % j == 0:
            count2 += 1

    if count2 == 8:
        count1 += 1

print(count1)

Submission status: Accepted

Solution code:
N = int(input())
Odd = [num for num in range(1,N+1) if num%2 == 1]
dic = {}
counter = 0
for i in Odd:
  dic[i] = []
  for x in range(1,i+1):
    if(i%x == 0):
      dic[i].append(x)
  if(len(dic[i])==8):
    counter += 1
print(counter)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1, N+1, 2):
    tmp = 0
    for j in range(1, i+1):
        if i % j == 0:
            tmp += 1
    if tmp == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import collections
N = int(input())


def prime_factorize(n):
    assert n > 0
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    m = 3
    while m ** 2 <= n:
        if n % m == 0:
            res.append(m)
            n //= m
        else:
            m += 2
    if n != 1:
        res.append(n)
    return res


ans = 0
for i in range(1, N+1, 2):
    d = collections.Counter(prime_factorize(i))
    tmp = 1
    for v in d.values():
        tmp *= (1 + v)
    if tmp == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())
ans = 0
for i in range(3,n+1,2):
    div = make_divisors(i)
    if len(div) == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
 
a = np.zeros(201)
for d in range(1,201,2):
  a[d::2*d] += 1

a = (a == 8).cumsum()
 
N = int(input())
print(a[N])

Submission status: Accepted

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors
  
N = int(input())  
ans = 0
for i in range(7, N+1, 2):
  cnt = len(make_divisors(i))
  if cnt == 8:
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

result = 0


for i in range(1,n+1):
    buf=[]
    if i%2!=0:
        for j in range(1,i+1):
            if i%j == 0:
                buf.append(j)
    if len(buf) == 8:
        result+=1

print(result)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0


def count_factors(n):
    c = 0

    for i in range(1, n + 1):
        if n % i == 0:
            c += 1

    return c


for i in range(1, N + 1, 2):
    if count_factors(i) >= 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    # divisors.sort()
    return divisors

cnt = 0
for i in range(1, N+1, 2):
    divis = make_divisors(i)
    if len(divis) == 8:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
if 104 >= n:
    print(0)
    exit()
ans = 0
for i in range(105,n+1,2):
    l1 = [0]*(i+1)
    count = 1
    for j in range(2,i+1):
        if i % j == 0:
            while i % j == 0:
                l1[j] += 1
                i //= j
    for k in l1:
        count *= (k+1)
    if count == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

resultNum = 0
for i in range(1,n+1):
  if i % 2 != 0:
      count = 0
      for j in range(1,i+1):
        if i % j == 0:
          count+=1
      if count == 8:
        resultNum += 1

print(resultNum)

Submission status: Accepted

Solution code:
N = int(input())
cnt, ans = 0, 0
for i in range(1, N + 1):
    cnt = 0
    for j in range(1, i + 1):
        if i % j == 0: cnt += 1
    if (cnt == 8 and i % 2 == 1): ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()

    for i, value in enumerate([105, 135, 165, 189, 195, 201]):
        if N < value: 
            print(i)
            sys.exit()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
[3,5,7,11,13]
A=[105,135,165,189,195]
ans=0
for i in A:
  if i <=N:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input().strip())
ans = 0
for i in range(1, (n + 1), 2):
    cnt = 0
    for j in range(1, (i + 1), 1):
        if (i % j == 0):
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
def func(n):
    sq = math.sqrt(n)
    cnt = 0
    if sq.is_integer():
        for i in range(1, int(sq)):
            if n%i==0:
                cnt += 1
        return 2*cnt + 1
    else:
        for i in range(1, int(sq)+1):
            if n%i==0:
                cnt += 1
        return 2*cnt 

n = int(input())
cnt = 0
for i in range(1, n+1):
    if i%2==0:
        continue
    elif func(i)==8:
        cnt = cnt + 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
# N = 105

divisor_cnt = 0
num = 0
# Nは奇数と言う制約があるため、約数は奇数×奇数の組み合わせ
for i in range(1, N+1, 2):
    divisor_cnt = 0
    for j in range(1, i+1, 2):
        if i % j == 0:
            divisor_cnt += 1
    if divisor_cnt == 8:
        num += 1  #


print(num)

Submission status: Accepted

Solution code:
ans = 0
n = int(input())
for i in range(3,n+1,2):
  temp = 0
  for j in range(1,i+1):
    if i%j == 0:
      temp += 1
  ans += (1 if temp == 8 else 0)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if (n < 105):
   print(0)
   exit()

i = 105
ok = 0
while i <= n:
   x = [j for j in range(1, n+1) if i % j == 0]
   if (len(x) == 8):
      ok += 1
   i += 2
print(ok)

Submission status: Accepted

Solution code:
# https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

n = int(input())

ans = 0

for i in range(1,n+1,2):
    if len(make_divisors(i)) == 8:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

for i in range(1,n+1,2):
    divisor = 0
    for ii in range(1,i+1):
        if i % ii == 0:
            divisor += 1
        
    if divisor == 8:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
ans = 0
for i in range(1, n+1):
    if i%2 != 0:
        for j in range(1, n+1):
            if i%j == 0:
                count += 1
        if count == 8:
            ans += 1
        count = 0

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1, N+1, 2):
    num = 0
    for j in range(1, i+1):
        if i % j == 0:
            num += 1
    if num == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1, N+1, 2):
    d = 0
    for k in range(1, i+1):
        if i % k == 0:
            d += 1
    if d == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for k in range(1, n+1, 2):
    cnt = 1
    for i in range(1, k):
        if k%i == 0:
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N < 105:
  print(0)
elif 105 <= N < 135:
  print(1)
elif 135 <= N < 165:
  print(2)
elif 165 <= N < 189:
  print(3)
elif 189 <= N < 195:
  print(4)
else:
  print(5)

Submission status: Accepted

Solution code:
N = int(input())

sup = (N + 1) // 2
con = 0
ans = 0

if N < 105:
  print(ans)

else:
  for i in range(1,N + 1,2):
    for j in range(1,max(i // 2 + 1,2)):
      if i % j == 0:
        con +=1
    if con == 7:
      ans += 1
    con = 0
      
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n + 1, 2):

    cnt = 1
    for j in range(2, n + 1):
        if i % j == 0:
           
            cnt += 1

    if cnt >= 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
from math import floor, sqrt
from bisect import bisect_right as bi_r 

def prime_nums(n):
    sieve = set(range(2, n + 1))
    non_prime = set(range(2 * 2, n + 1, 2))
    sieve -= non_prime
    for i in range(3, floor(sqrt(n)) + 1, 2):
        if i in sieve:
            non_prime = set(range(i * 2, n + 1, i))
            sieve -= non_prime
    return sieve

n = int(sys.stdin.readline().rstrip())
ps = prime_nums(n)
ps -= set([2])
ps = sorted(ps)

def main():
    l = len(ps)
    cnt = 0

    # p**4
    for i in range(1, l+1):
        p = ps[i-1]
        if p ** 7 <= n:
            cnt += 1
        else:
            break
    
    # p**3 * q
    for i in range(1, l+1):
        p = ps[i-1]
        j = bi_r(ps, n // p ** 3)
        if j >= i:
            cnt += j - 1
        elif j > 0:
            cnt += j
        else:
            break
        
    # p * q * r
    for i in range(1, l-1):
        p = ps[i-1]
        for j in range(i+1, l):
            q = ps[j-1]
            if p * q > n:
                break
            for k in range(j+1, l+1):
                r = ps[k-1]
                if p * q * r > n:
                    break
                cnt += 1

    return cnt

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
ans = 0

#n以下のすべての奇数について全探索
for i in range(1, n+1, 2):
    count = 0
    for j in range(1, i+1):
        if i % j == 0:
            count += 1
        if count == 8:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

res = 0

for i in range(1, n+1):
    cnt = 0
    for j in range(1, i+1):
        if i % j == 0:
            cnt += 1
    if cnt == 8 and i % 2 == 1:
        res += 1
print(res)

Submission status: Accepted

Solution code:
def divisor(n):
    i = 1
    ans_div = []
    while i * i <= n:
        if n%i == 0:
            ans_div.append(i)
            ans_div.append(n // i)
        i += 1
    ans_div = list(set(ans_div))
    return ans_div
import sys
input = sys.stdin.readline
N = int(input())
count = 0
if N < 105:
    print(0)
else:
    for odd in range(105, N+1, 2):
        li = divisor(odd)
        if len(li) == 8:
            count += 1
    print(count)

Submission status: Accepted

Solution code:
N=int(input())
cnt=0
buf=0
for i in range(1,N+1):
    for j in range(1,i+1):
        if i%j==0:
            buf+=1
    
    if buf==8 and i%2!=0:
        cnt+=1
    buf=0
    
print(cnt)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
if N < 105 :
    print(0)
elif N >= 105 and N<135 :
    print(1)
elif N>= 135 and N<165 :
    print(2)
elif N>=165 and N<189 :
    print(3)
elif N>=189 and N<195 :
    print(4)
else :
    print(5)

Submission status: Accepted

Solution code:
N = int(input())
ans=1
if N <=104:
  print(0)
elif N==105 or N==106:
  print(1)
else:
  for i in range(107,N+1,2):
    i_div ={div for div in range(1,i+1) if i%div == 0}
    if len(i_div) == 8:
      ans+=1
  print(ans)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
ans = 0

for i in range(1, N+1, 2):
    cnt = 0
    for j in range(1, i + 1):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
N = int(input())

if N == 105 :
  print (1)
  exit()
elif N < 105 :
  print (0)
  exit()
  
cnt = 1
for i in range(107, N+1, 2) :
  q = 0
  for j in range(1, i+1) :
    if i%j == 0 :
      q += 1
      #print (str(j))
  if q == 8 :
    cnt += 1
    #print ("Q:" + str(i))
print (cnt)

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353




def get_divisors(n):
    """
    n の約数をリストで返す
    :param int n:
    :rtype: list of int
    """
    ret = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            ret.append(i)
            if n // i != i:
                ret.append(n // i)
    return ret


n = int(sys.stdin.buffer.readline())
ans = 0
for i in range(1, n +1):
    ans +=i& 1 and len(get_divisors(i)) == 8
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
odd_list = [num for num in range(1, n+1, 2)]
cnt_8 = 0
for i in odd_list:
    cnt = 0
    for j in range(1, i+1, 2):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        cnt_8 += 1
print(cnt_8)

Submission status: Accepted

Solution code:
import math
n = int(input())
lst = [x for x in range(1, n + 1) if x % 2 != 0]
def div(x):
    lst_2 = []
    for i in range(1, int(math.sqrt(x)) + 1):
        if x % i == 0 and x // i != i:
            lst_2.append(i)
            lst_2.append(x // i)
        if x % i == 0 and x // i == i:
            lst_2.append(i)
    return lst_2

cnt = 0
for i in lst:
    div_lst = div(i)
    if len(div_lst) == 8:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

for i in range(1,n+1):
    if i%2:
        if len(make_divisors(i)) == 8:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8


def get_ans(num: int):
    if num < 105:
        return 0
    ans = 0
    for i in range(105, num + 1):
        if i % 2 == 0:
            continue
        if cnt_yaku(i):
            ans += 1
    return ans


def cnt_yaku(num: int):
    ans = 0
    for i in range(1, num + 1):
        if num % i == 0:
            ans += 1
    return ans == 8


num = int(input())
ans = get_ans(num)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())


A = []
c = 0
for i in range(1, n+1, 2):
    for j in range(1, i+1,2):
        if i%j==0:
            c += 1
    if c == 8:
        A.append(i)
    c = 0
print(len(A))

Submission status: Accepted

Solution code:
n=int(input())
ans=0
if n>=105:
  ans+=1
if n>=135:
  ans+=1
if n>=165:
  ans+=1
if n>=189:
  ans+=1
if n>=195:
  ans+=1
print(ans)