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())

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

ans = 0
for i in range(1, N+1):
  if i % 2 == 1 and len(divisor(i)) == 8:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()

def mdiv(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(1,n+1):
    a=mdiv(i)
    if i%2==1 and len(a)==8:
        ans+=1
print(ans)

Submission status: Accepted

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

    return ans

print(solve())

Submission status: Accepted

Solution code:
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

def solve():
    N = int(input())
    
    c = 0
    for i in range(1, N+1, 2):
        f = factorize(i)
        b = 1
        for j in f:
            b += b * j[1]
        if b == 8:
            c += 1

    return c

print(solve())

Submission status: Accepted

Solution code:
N=int(input())

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

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

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline())
ans = 0
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:
        # print(i)
        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
    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:
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())
# print(len(make_divisors(N)))
answer = 0
for i in range(1, N+1):
    # print(len(make_divisors(i)))
    if len(make_divisors(i)) == 8 and i % 2 != 0:
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for i in range(8,N+1):
    if i%2==0: continue
    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:
def yaku(n):
    A = []
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            A.append(i)
            A.append(n//i)
    return len(A)
N = int(input())
cnt = 0
for i in range(1,N+1,2):
    if yaku(i)==8:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
def ABC106():
    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 = I()
    ans = 0
    for i in range((N+1)//2):
        cur = i*2+1
        if len(make_divisors(cur))==8:
            ans += 1
    print(ans)
    return

def exam2():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    ABC106()

"""

"""

Submission status: Accepted

Solution code:
n=int(input())
app=[]
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:
        app.append(i)

print(len(app))

Submission status: Accepted

Solution code:
N=int(input())
count = 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 len(make_divisors(i))==8 and i%2==1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(105,n+1,2):
    cnt2 = 0
    for j in range(3,i,2):
        if i % j == 0:
            cnt2 += 1
    if cnt2 == 6:
        cnt += 1
print (cnt)

Submission status: Accepted

Solution code:
n=int(input())
print(sum(i<=n for i in [105,135,165,189,195]))

Submission status: Accepted

Solution code:

n = int(input())
tmp = 0
ans = 0

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

        if tmp == 8:
            ans += 1

        tmp = 0

print(ans)

Submission status: Accepted

Solution code:
def 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):
    if i%2 != 0 and len(divisors(i)) == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

for n in range(1, N + 1, 2):
    ndiv = 0
    for d in range(1, N + 1):
        if n % d == 0: ndiv += 1
    if ndiv == 8:  ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ret = 0
for x in range(1, n + 1, 2):
    t = 1
    for i in range(2, x + 1):
        k = 0
        while x % i == 0:
            k += 1
            x //= i
        t *= k + 1
        if x == 1:
            break

    if t == 8:
        ret += 1

print(ret)

Submission status: Accepted

Solution code:
class Sieve:
    """区間[2,n]の値を素因数分解する"""

    def __init__(self, n=1):
        primes = []
        f = [0] * (n + 1)
        f[0] = f[1] = -1
        for i in range(2, n + 1):  # 素数を探す
            if f[i]: continue
            primes.append(i)
            f[i] = i  # 素数には自身を代入
            for j in range(i * i, n + 1, i):  # 合成数に素因数を書き込む
                if not f[j]:
                    f[j] = i  # 最小の素因数を代入
        self.primes = primes
        self.f = f

    def is_prime(self, x) -> bool:  # 素数判定
        return self.f[x] == x

    def factor_list(self, x) -> list:  # 素因数分解の昇順リスト, [2,2,3,5,...]
        res = []
        while x != 1:
            res.append(self.f[x])
            x //= self.f[x]
        return res

    def factor(self, x) -> list:  # 素因数分解の頻度リスト, [[2,x],[3,y],[5,z],...]
        fl = self.factor_list(x)
        if not fl: return []
        res = [[fl[0], 0]]
        for p in fl:
            if res[-1][0] == p:
                res[-1][1] += 1
            else:
                res.append([p, 1])
        return res


n = int(input())
s = Sieve(n)

ret = 0
for x in range(1, n + 1, 2):
    t = 1
    for prime, cnt in s.factor(x):
        t *= cnt + 1

    if t == 8:
        ret += 1

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans=0

for i in range(1,N+1):
    howyaku=0
    if i%2==0:
        continue
    for k in range(1,int(i**0.5)+1):
        if i%k==0:
            howyaku+=1
            if k != i//k:
                howyaku+=1
    if howyaku==8:
        ans+=1

print(ans)

Submission status: Accepted

Solution code:
import math
N=int(input())
ans=0
if N<105:
	print(0)
else:
	for i in range (105,N+1):
		tmp=[]
		if i%2==1:
			for j in range(1,int(math.sqrt(N)+1)):
				if i%j==0:
					tmp.append(j)
					tmp.append(i//j)
			if len(set(tmp))==8:
				ans+=1
	print(ans)

Submission status: Accepted

Solution code:
N=int(input())
if N<105:
  print(0)
  exit()
cnt=1
for i in range(107,N+1,2):
  tmp=0
  for j in range(1,N+1):
    if i%j==0:
      tmp+=1
  if tmp==8:
    cnt+=1
print(cnt)

Submission status: Accepted

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

for i in range(1, n+1):
    count = 0
    if i % 2 == 0: continue
    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())

def divisor(n):
  i = 2
  count = 0
  divs = []
  while n != 1:
    if n % i:
      if count :
        divs.append(count)
        count = 0
      i+= 1
    else:
      n = n //i
      count += 1
      if n == 1:
        divs.append(count)
  ans = 1
  for d in divs:
    ans *= (d + 1)
  return ans

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

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:
n = int(input())


def 約数(n):
	count = 0
	for i in range(1,n+1):
		if n%i == 0:
			count += 1
	if count == 8:
		return True
	else:
		return
if n == 105:
	print(1)
elif n < 105:
	print(0)
else:
	ans = 1
	for i in range(106,n+1):
		if i%2 !=0:
			if 約数(i):
				ans += 1


	print(ans)

Submission status: Accepted

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

n = int(input())
res = 0
for i in range(1, n+1, 2):
    if len(divisor(i))==8:
        res += 1
print(res)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n+1):
    if i % 2 == 0:
        continue
    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 sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True

    @staticmethod
    def divisor(n):
        i = 1
        table = []
        while i * i <= n:
            if n % i == 0:
                table.append(i)
                table.append(n // i)
            i += 1
        table = list(set(table))
        return table


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)

    def list(self):
        return self.__q

    def length(self):
        return len(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    # sys.stdin = open("Sample.txt")
    N = Scanner.int()
    ans = 0
    for i in range(1, N + 1, 2):
        if len(Math.divisor(i)) == 8:
            ans += 1
    print(ans)
    return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N= int(input())
if N%2==0:
    cand = list(range(1,N,2))
else:
    cand = list(range(1,N+1,2))

ans = 0
num = 0
for n in range(1,N+1):
    num = 0
    for c in cand:
        if n%c==0:
            num+=1
    if num ==8:
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
num=[3*5*7,3*3*3*5,3*5*11,3*3*3*7,3*5*13]
ans=0
for i in range(5):
    if n>=num[i]:
        ans+=1
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
 
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()) + 1
nums_count = 0
for i in range(1, N):
    if i % 2 == 0:
        continue
    count = 1
    for j in range(1, int(i / 3) + 1):  # 8なら1,2,4,8で、1~4までやれば良い。最後に自分をたす あれ、もしかしてN/3?
        if i % j == 0:
            count += 1
    if count == 8:
        nums_count += 1

print(nums_count)

Submission status: Accepted

Solution code:
N = int(input()) + 1
nums_count = 0
for i in range(1, N):
    if i % 2 == 0:
        continue
    count = 1
    for j in range(1, int(i / 2)):  # 8なら1,2,4,8で、1~4までやれば良い。最後に自分をたす あれ、もしかしてN/3?
        if i % j == 0:
            count += 1
    if count == 8:
        nums_count += 1

print(nums_count)

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)

    return divisors

def main():
    n = int(input())

    ans = 0

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n=int(input())
ans=0
for i in range(1,n+1):
    tmp=0
    if i%2==1:
        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:
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())
ans=0
for i in range(1,N+1):
  count=0
  for j in range(1,i+1):
    if i%j==0:
      count+=1
  if i%2==1 and count==8:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = []

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

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

    if len(divisors) == 8:
        ans.append(i)

print(len(ans))

Submission status: Accepted

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

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

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

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:
def main():
    n = int(input())
    ans = [0] * 201
    cnt = 0
    a = [0] * 201

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

    print(a[n])



if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())


def f(x):
    c = 0
    for i in range(1, int(x**.5)+1):
        if x%i==0:
            c += 1 if i*i==x else 2
    return c

c = 0
for i in range(1, N+1, 2):
    if f(i)==8:
        c += 1

print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def divisors(n):
    res = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            res.append(i)
            if i != n // i:
                res.append(n // i)
    return len(res)
    
arr = [0, 0] + [1 if divisors(i) == 8 and i % 2 else 0 for i in range(2, 201)]
N = int(input())

print(sum(arr[: N + 1]))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc106/tasks/abc106_b

N = int(input())

ans = 0
# X % M == 0
for X in range(1,N+1,2):
    cnt = 0
    for M in range(1,X+1,2):
        if X % M == 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,2):
  if i%(i**0.5)==0:
    continue
  t=0
  for j in range(1,i+1):
    if i%j==0:
      t+=1
  c+=(t==8)
print(c)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 0
for i in range(1,N+1):
	if i % 2 == 0:
		continue
	q = set()
	d = math.floor(i**(1/2))
	for j in range(1,d+1):
		if i % j == 0:
			q.add(j)
			q.add(i//j)

	if len(q) == 8:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for n in range(1,N+1,2):
    d = set()
    m = 1
    while m*m <= n:
        if n%m==0:
            d.add(m)
            d.add(n//m)
        m += 1
    if len(d)==8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:


N = int(input())

has8 = [0] * 201
for num in range(1,201):
    cnt = 0
    if num % 2 == 1:
        for m in range(1,num+1):
            if num % m == 0:
                cnt += 1
        if cnt == 8:
            has8[num] = 1

total = [0] * 201
for i in range(1,201):
    total[i] = total[i-1] + has8[i]

print(total[N])

Submission status: Accepted

Solution code:
#abc 106 b yakusu
import itertools
def yakusu(x):
    wareru=[]
    for i in range(1,x+1):
        if x%i==0:
            wareru.append(i)
    num=len(wareru)
    return num

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

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1,n+1,2):
  a=0
  for j in range(1,i+1):
    if i%j==0:
      a=a+1
  if a==8:
    ans=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)
    return divisors


def solve():
    N = int(input())
    
    ans = 0
    for i in range(1, N + 1, 2):
        divisors = make_divisors(i)
        if len(divisors) == 8:
            ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):

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


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


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    result = 0
    for n in range(105, N + 1, 2):
        cnt = 0
        for i in range(1,200):
            if n % i == 0:
                cnt += 1
            if n < i or cnt > 8:
                break
        if cnt == 8:
            result += 1
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 0
for m in range(1,N+1,2):
    P = set([1,m])
    for k in range(2,math.floor(math.sqrt(m))+1):
        if m % k == 0:
            P.add(k)
            P.add(m//k)
    if len(P) == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


## 約数の列挙O(√N)
def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return len(table)
  
i = 1
answer = 0
while i <= N:
  if divisor(i) == 8:
    answer += 1
  i += 2
print(answer)

Submission status: Accepted

Solution code:
n = int(input())

odd = [2*i + 1 for i in range(n) if (2*i +1) <= n]
ans = 0
for i in odd:
    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())
num = 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:
            num += 1
print(num)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#106_B
N=int(input())
cnt=0
for x in range(1,N+1,2):
    tmp=0
    for i in range(1,x+1):
        if x%i==0:
            tmp+=1
    if tmp==8:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())


def func(x):
    if x % 2 == 0:
        return 0

    cnt = 0
    for i in range(1, x + 1):
        if x % i == 0:
            cnt += 1
    if cnt == 8:
        return 1
    else:
        return 0


ans = 0
for i in range(1, N + 1):
    ans += func(i)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

ans = 0
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())
total, count = 0,0
for i in range(1, n+1, 2):
    for j in range(1, i+1):
        if i % j == 0:
            count += 1
    if count == 8:
        total += 1
    count = 0
print(total)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

for i in range(1,N+1):
    count = 0
    if i%2 == 1:
        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())
c=[]
v=0
for i in range(1,N+1):
  c=[]
  if i%2!=0:
    for j in range(1,i+1):
      if i%j==0:
        c.append(j)
        if len(c)==8:
          v+=1
print(v)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
if n < 105:
    print(0)
else:
    for i in range(105, n +1, 2):
        div = []
        for j in range(1, int(math.sqrt(i**2) + 1)):
            if i % j == 0:
                div.append(j)
                if j != i // j:
                    div.append(i //j)
        if len(div) // 2 == 8:
            ans += 1
    print(ans)

Submission status: Accepted

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

ans = 0
if n < 105:
    print(0)
else:
    for i in range(105, n +1):
        if i % 2 == 0:
            continue
        div = []
        for j in range(1, int(math.sqrt(i**2) + 1)):
            if i % j == 0:
                div.append(j)
                if j != i // j:
                    div.append(i //j)
        if len(div) // 2 == 8:
            ans += 1
    print(ans)

Submission status: Accepted

Solution code:
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())

odd = []
for i in range(N+1):
    if i % 2 == 1:
        odd.append(i)


ans_odd = []
for i in odd:
    cnt = 0
    for j in range(1, N+1):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        ans_odd.append(i)

print(len(ans_odd))

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np

def main():
	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)
	
	
if __name__ == "__main__":
	main()