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 check_divisor(number):
	divisors = 0
	for j in range(1, number+1, 2):
		if not (number%j):
			divisors += 1
			if divisors == 9: return False
	if divisors == 8: return True
	else: return False

count = 0
for i in range(1, N+1, 2):
	if check_divisor(i):
		count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for n in range(1, N + 1, 2):
    route_n = int(n ** (1 / 2))
    by = [] 
    for i in range(1, route_n + 1, 2):
        if n % i == 0:
            by.append(i)
            a = n // i
            if a != i:
                by.append(a)
    if len(by) == 8:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    count = 0
    x_list =[3**3*5, 3**3*7, 3*5*7, 3*5*11, 3*5*13]
    for one in x_list:
        if one<=n:
            count+=1
    print(count)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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:
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    d =[0] *201

    for i in range(1,201):
        for k in range(1,201):
            if k%i==0 and k%2==1:
                d[k] +=1



    N = int(input())

    print(d[:N+1].count(8))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def make_divisors(n):
    #https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

Submission status: Accepted

Solution code:
N=int(input())

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
  
counter = 0
for i in range(1,N+1,2):
  if len(divisor(i)) == 8:
    counter += 1

print(counter)

Submission status: Accepted

Solution code:
import math
def is_square(N):
    return math.sqrt(N) - int(math.sqrt(N)) == 0

def get_divisor_count(N):
    divisor_count = 0
    for i in range(1,int(math.sqrt(N))+1):
        if N%i == 0:
            divisor_count += 1
    return divisor_count*2 if is_square(N) == False else divisor_count*2 - 1
if __name__ == "__main__":
    N = int(input())
    count = 0
    for i in range(1,N+1,2):
        if get_divisor_count(i) == 8:
            count += 1
    print(count)

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, 2):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
res = 0
for i in range(1, n + 1, 2):
    counter = 0
    for j in range(1, int(i ** (1/2)) + 1):
        if i % j == 0:
            counter += 1
            if i // j != j:
                counter += 1
    if counter == 8:
        res += 1

print(res)

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
def count_divisor(n):
    arr = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            arr.append(i)
            arr.append(n//i)
    res = len(set(arr))
    return res

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

Submission status: Accepted

Solution code:
N = int(input())

y = 0
def X(num):
  x = 0
  for i in range(1,num+1):
    if num%i == 0:
      x += 1
  return x
for j in range(1,N+1):
  if X(j) == 8 and j%2==1:
    y = y+1
print(y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8

def factoraization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp%i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if (temp != 1):
        arr.append([n, 1])
    
    return arr
    
if __name__ == '__main__':
    N = int(input())
    
    num_lst = []
    for i in range(1, N + 1, 2):
        num_lst.append(i)
        
    result = 0
    
    for j in num_lst:
        
        count = 1
        x = factoraization(j)

        for t in range(len(x)):
            count *= (int(x[t][1]) + 1)
            
            if count == 8:
                result += 1
    
    print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    lower.extend(reversed(upper))
    return lower


def main():
    N = int(readline())

    ans = 0
    for n in range(1, N + 1, 2):
        if len(divisors(n)) == 8:
            ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return len(lower_divisors + upper_divisors[::-1])


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    ans = 0
    for i in range(1, n + 1, 2):
        if make_divisors(i) == 8:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def count_divisors(n):
    count = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            count += 1
            if i != n // i:
                count += 1
    return count
def main():
    n = int(input())
    ans = 0
    for i in range(1, n + 1, 2):
        if count_divisors(i) == 8:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
if 1<=N and N<=104 :
  print(0)
elif N<=134 :
  print(1)
elif N<=164 :
  print(2)
elif N<=188 :
  print(3)
elif N<=194 :
  print(4)
else :
  print(5)

Submission status: Accepted

Solution code:
n = int(input())
def num_factors(num):
    facts=2
    for i in range(2,num):
        if num%i == 0:
            facts += 1
    return facts

print(sum([num_factors(i)==8 for i in range(1,n+1) if i&1]))

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0
for i in range(1,n+1,2):
    if divs(i) == 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())
cnt =  0
ans = 0

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:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

n = int(input())

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

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

Submission status: Accepted

Solution code:
N=int(input())
if N<105:
    print(0)
elif N==105:
    print(1)
else:
    ans=1
    for n in range(106,N+1):
        if n%2:
            K=n//2
            y=0
            #print(n,K)
            for k in range(2,K+1):
                if n%k==0:
                    y+=1
                    #print(k)
            if y==6:
                #print(n)
                ans+=1
    print(ans)

Submission status: Accepted

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

def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(input())

    return N


def divisor_count(n: int) -> int:
    """
    引数の約数の個数を取得する.

    Args:\n
        n (int): 引数

    Returns:\n
        int: 約数の個数
    """
    ans = 0
    i = 1
    while i * i <= n:
        if n % i == 0:
            ans += 1
            if i != n // i:
                ans += 1
        i += 1
    return ans


def main(N: int) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 整数（1 <= N <= 200）
    """
    # 求解処理
    ans = 0
    for n in range(1, N + 1, 2):
        if divisor_count(n) == 8:
            ans += 1

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N = get_input()

    # メイン処理
    main(N)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())


def divisor_count(n: int) -> int:
    ans = 0
    i = 1
    while i * i <= n:
        if n % i == 0:
            ans += 1
            if i != n // i:
                ans += 1
        i += 1
    return ans

# 求解処理
ans = 0
for n in range(1, N + 1, 2):
    if divisor_count(n) == 8:
        ans += 1

# 結果出力
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

#https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

count=0
for i in range(1, N+1):
  if i%2==1 and len(make_divisors(i))==8:
    count+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0

#約数取得
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2, log10, pi
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __radd__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x + self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x + self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rsub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x - self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x - self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rmul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rtruediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __rpow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(other.__x, self.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(other.__x, self.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")

    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x
    def __str__(self):
        return str(self.__x)



if __name__ == '__main__':
    N = intinput()
    cnt = 0
    for n in range(1, N+1, 2):
        ans = 0
        for i in range(3, n, 2):
            if n % i == 0:
                ans += 1
            if ans > 6:
                break
        if ans == 6:
            cnt += 1

    # 出力
    print(cnt)

Submission status: Accepted

Solution code:
def abc106_b():
    n = int(input())
    have_8_divisors = 0

    def count_up_divisor(check_num):
        cnt = 0
        for i in range(1, check_num + 1):
            # 1からcheck_numを順に探索して、nの約数かどうか判断して、約数の時はカウント
            if check_num % i == 0:
                cnt += 1
        return cnt

    for i in range(1, n + 1):
        # 偶数の時はスキップ
        if i % 2 == 0:
            continue

        result = count_up_divisor(i) == 8
        if result:
            have_8_divisors += 1

    print(have_8_divisors)

if __name__ == '__main__':
    abc106_b()

Submission status: Accepted

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

def count_up_divisor(check_num):
    cnt = 0
    for i in range(1, check_num + 1):
        # 1からcheck_numを順に探索して、nの約数かどうか判断して、約数の時はカウント
        if check_num % i == 0:
            cnt += 1
    return cnt


for i in range(1, n + 1):
    # 偶数の時はスキップ
    if i % 2 == 0:
        continue

    result = count_up_divisor(i) == 8
    if result:
        have_8_divisors += 1

print(have_8_divisors)

Submission status: Accepted

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

    result = cnt == 8
    if result:
        have_8_divisors += 1

print(have_8_divisors)

Submission status: Accepted

Solution code:
import copy
import math

# a = get_int()
def get_int():
    return int(input())
# a = get_string()
def get_string():
    return input()
# a_list = get_int_list()
def get_int_list():
    return [int(x) for x in input().split()]
# a_list = get_string_list():
def get_string_list():
    return input().split()
# a, b = get_int_multi()
def get_int_multi():  # a, b = get_int_multi()
    return map(int, input().split())
# a_list = get_string_char_list()
def get_string_char_list():
    return list(str(input()))
# print("{} {}".format(a, b))
# for num in range(0, a):
# a_list[idx]
# a_list = [0] * a
'''
while (idx < n) and ():

    idx += 1
'''

def main():

    n = get_int()

    ans = 0

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

        if count == 8:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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:
N=int(input())
 
ans=0
odd=[]
for i in range(1,N+1):
  if i%2!=0:
    odd.append(i)
    
if N  <104:
  pass
else:
  for i in range(105,N+1):
    if i%2!=0:
      tmp=0
      for j in odd:
        if i%j==0:
          tmp+=1
      if tmp==8:
        ans+=1 
print(ans)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())

    count_1 = 0
    for i in [_ for _ in range(1, N+1) if _ % 2 == 1]:
        count_2 = 0
        for j in range(1, i+1):
            if i % j == 0:
                count_2 += 1
        if count_2 == 8:
            count_1 += 1
    print(count_1)


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    ans = 0
    for n in range(1, N+1, 2):
        cnt = 0
        for p in range(1, n+1):
            if n%p==0:
                cnt += 1
        if cnt==8:
            ans += 1
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
# (a * b * c) or (d * d * d * e)
# (a, b, c) = (3, 5, 7) -> 105
# (a, b, c) = (3, 5, 11) -> 165
# (a, b, c) = (3, 5, 13) -> 195
# (a, b, c) = (3, 5, 17) -> 255 out
# (a, b, c) = (3, 7, 11) -> 231 out
# (d, e) = (3, 5) -> 135
# (d, e) = (3, 7) -> 189
# (d, e) = (3, 11) -> 297 out
# (d, e) = (5, 3) -> 375 out
# therefore: 105, 135, 165, 189, 195

ans = [0, 105, 135, 165, 189, 195, 1000000000]
for i in range(6):
  if ans[i] <= N < ans[i + 1]:
    print(i)

Submission status: Accepted

Solution code:
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())
m = 0
k=0

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

print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()

s=0
yakusu=0



for i in range(1,int(n)+1):
    s=0
    if i%2!=0:
        for k in range(1,i+1):
            if i%k==0:
                s+=1    
    if s==8:
        yakusu+=1         

print(yakusu)

Submission status: Accepted

Solution code:
import math
N = int(input())
count = 0
def divisoros_count(n):
    num = 0
    for i in range(1,int(math.sqrt(n))+1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    return num

for i in range(1,N+1,2):
    if divisoros_count(i) == 8:
        count += 1

print(count)

Submission status: Accepted

Solution code:
#関数リスト
import sys
input = sys.stdin.readline


def RD(): return input().rstrip()
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    num = I()
    result = 0
    for i in range(1,num+1,2):
        temp = len(make_divisors(i))
        if temp == 8:
            result += 1
    print(result)
        
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

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
    
cnt = 0
for i in range(1, N+1):
    if i % 2 != 0 and len(divisor(i)) == 8:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import ceil
def numdiv(n):
    c=0
    k=int((n)**0.5)
    for i in range(1,k+1):
        if n%i==0:
            c+=2
    if k==ceil(n**0.5):
        return c-1
    return c

c=0
n=int(input())
for i in range(3,n+1,2):
    if numdiv(i)==8:
        c+=1


print(c)

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

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

ans = 0
for i in range(105,N+1,2):
    cnt = 0
    for q in range(1,int(i**0.5)+1):
        if i % q == 0:
            cnt += 2
    if cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def check(n):
  d=[]
  for i in range(1,int(n**0.5)+1,2):
    if n%i==0:
      d.append(i)
      if i!=n//i:
        d.append(n//i)
  if len(d)==8: return True
  else: return False

r=[]
for i in range(1,int(input())+1,2):
  r.append(int(check(i)))
print(sum(r))

Submission status: Accepted

Solution code:
N = int(input())

def divisor_pairs(n):
  # n の正の約数の数
  # ペアの数を保存しておけばいい
  pairs = 0

  # 約数判定はO(√N)で出来るということを知っておく
  i = 1

  while i * i <= n:
    if n % i == 0:
      pairs += 1
    i += 1
  return pairs

result = 0

# 奇数なのでステップ数を2に指定
for x in range(1, N+1, 2):
  if divisor_pairs(x) == 4:
    result += 1

print(result)

Submission status: Accepted

Solution code:
n=int(input())
if n<105:
    print(0)
    exit()
ans=0
for i in range(105,n+1,2):
    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:
N = int(input())

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

    count = 1
    for i in range(3, n+1, 2):
        if n % i == 0:
            count += 1
        if n == 1:
            break
    if count == 8:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import itertools
import numpy as np


def check_eight(n):
    div_list = []
    for i in range(3, n + 1, 2):
        if n % i == 0:
            while n % i == 0:
                n = n // i
                div_list.append(i)
        if n == 1:
            break

    answer_list = []
    for i in range(1, len(div_list)+1):
        comb = itertools.combinations(div_list, i)
        for c in comb:
            c = np.array(c)
            answer_list.append(c.prod())
    answer = len(set(answer_list)) + 1
    
    return answer == 8

if __name__ == "__main__":
    N = int(input())

    count = 0
    for n in range(1, N + 1, 2):
        count += check_eight(n)

    print(count)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(8, n+1):
    #8回割れるかどうか
    divisor_cnt = 0
    for j in range(1, n+1):
        if i % j == 0 and j % 2 == 1:
            divisor_cnt += 1
    if divisor_cnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans = 1
    if N < 105:
        print(0)
    elif N == 105:
        print(1)
    else:
        for i in range(106, N+1):
            temp = 0
            if i % 2 == 0:
                continue
            for j in range(1, N+1):
                if i % j == 0:
                    temp += 1
            if temp == 8:
                ans += 1
        print(ans)
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import collections
import fractions
import itertools
import functools
import operator

def yakusu_rekkyo(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def solve():
    n = int(input())
    cnt = 0
    for i in range(1,n+1):
        hoge = 0
        for j in yakusu_rekkyo(i):
            if j%2 == 1:
                hoge += 1
        if hoge == 8:
            cnt += 1
    print(cnt)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for x in range(1,N+1):
  if x%2==1:
    c=0
    for y in range(1,x+1):
      if x%y==0:
        c+=1
      if c>8:
        break
    if c==8:
      ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
l=[105,135,165,189,195]
for i in range(n+1):
  if i in l:
    ans+=1
print(ans)

Submission status: Accepted

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