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

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

N = int(input())
if N < 105:
    print(0)
    exit(0)
else:
    cnt = 1
    for i in range(107, N+1, 2):
        x = 1
        c = collections.Counter(prime_factorize(i))
        li = c.values()
        for j in li:
            j += 1
            x *= j
        if x == 8:
            cnt += 1
    print(cnt)

Submission status: Accepted

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

N = int(input())


def is_8(num):
    if num < 1:
        return False
    elif num == 1:
        return False
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)
        if len(divisor_list) == 8:
            return True

cnt = 0
for i in range(1, N + 1, 2):
    if is_8(i):
        cnt += 1

print(cnt)

Submission status: Accepted

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

    # divisors.sort()
    return cnt

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

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(1,n+1):
    cnt = 0
    if i%2==0:
        continue
    for j in range(1,int(i**(1/2))+1):
        if i%j == 0:
            if j == i//j:
                cnt += 1
            else:
                cnt += 2
    if cnt == 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
  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:
S=int(input())
count=0
 
for i in range(1,S+1,2):
    a=0
    for j in range(1,i+1):
        if i % j ==0:
            a+=1
    if a==8:
        count+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

result = [1] * (N + 1)

for i in range(2, N + 1):
    result[i] += 1
    temp = 2
    while temp * i <= N:
        result[temp * i] += 1
        temp += 1

hoge = 0
for i, v in enumerate(result):
    if (i % 2) == 1 and v == 8:
        hoge += 1

print(hoge)

Submission status: Accepted

Solution code:
n=int(input())
res=0
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:
    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:
N = int(input())
ans = 0
for i in range(1, N + 1, 2):
    cnt = 0
    for j in range(1, int(i**0.5) + 1):
        if i % j == 0:
            if i // j != j: cnt += 1
            cnt += 1
    if cnt == 8: ans += 1
print(ans)

Submission status: Accepted

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

n=int(input())
ans=[]
for i in range(1,n+1,2):
    if len(make_divisors(i))==8:
        ans.append(i)
print(len(ans))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1, n+1):
    cnt = 0
    for j in range(1, i + 1):
        if i % 2 == 0:
            break
        else:
            if i % j == 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):
    cnt=0
    for j in range(1,i+1):
        if i%2==0:
            break
        else:
            if i%j==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
  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())
l = []
cnt = 0
odd = []
for j in range(1,n+1):
    if j % 2 == 1:
        odd.append(j)
for k in odd:
    l = []
    for s in range(1,k+1):
        if k % s == 0:
            l.append(s)
        if len(l) == 8:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())

res=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:
            res+=1

print(res)

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
lis = [i for i in range(2,N+1) if i%2 == 1]
ans2=0
check =0
for one in lis:
    Prime = []
    count=[]
    t = 0
    ans1 =1
    for k in range(2,one+1):
        while(one % k)==0:
            one //= k
            if(k in Prime):
                count[Prime.index(k)]+=1
            else:
                Prime.append(k)
                count.append(1)
                t +=1
    for j in range(0,t):
        ans1 *= (count[j] + 1)
    if(ans1 == 8):
        ans2 +=1
print(ans2)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(N):
    divisor_count = 0
    for j in range(i + 1):
        # 偶数は対象外
        if (j + 1) % 2 == 0:
            continue
        if (i + 1) % (j + 1) == 0:
            divisor_count += 1
    if divisor_count == 8:
        count += 1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
counter = 0
for i in range(n):
  if (i + 1) % 2 == 0:
    continue
  _c = 0
  for j in range(n):
    if (i + 1) % (j + 1) == 0:
      _c += 1
  if _c == 8:
    counter += 1
    #print(i + 1)
print(counter)

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
n=int(input())
c=0
for i in range(1,n+1,2):
    a=make_divisors(i)
    if len(a)==8:
        c+=1
print(c)

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:
n = int(input())
count = 0
ans = 0
j = 1

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

Submission status: Accepted

Solution code:
n = int(input())

count = 0

if(n >= 105):
    for i in range(105, n+1, 2):
        l = []
        for j in range(1, i+1):
            if (i % j == 0):
                l += [j]
        if(len(set(l)) == 8):
            count += 1

print(count)

Submission status: Accepted

Solution code:
import math

n = int(input())
ans = 0
for i in range(105, n+1, 2):
    cnt = 0
    for j in range(2, int(math.sqrt(i-1))+1):
        # print(i, j)
        if i % j == 0:
            cnt += 1
    if cnt == 3:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def factorization(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([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

count = 0
n = int(input())
for i in range(1,n+1):
    if i % 2 == 1:
        num_list = factorization(i)
        sum = 1
        for num in num_list:
            sum *= (num[1]+1)
        if sum == 8:
            count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())

odd = list()

count_list = list()
count = 0

for a in range(1, N+1):
    if a % 2 != 0:
        odd.append(a)

l = len(odd)

for a in range(0, l):
    for b in range(1, odd[a]+1):
        if odd[a] % b == 0:
            count += 1
    count_list.append(count)
    count = 0

print(len(list(filter(lambda x: x == 8, count_list))))

Submission status: Accepted

Solution code:
def main():
    # 入力
    n = int(input())
    if n < 105:
        print(0)
        return

    cnt = 1

    for i in range(106, n+1):
        if i % 2 == 0:
            continue
        tmp_cnt = 0

        # ls = []
        for j in range(3, i):
            if i % j == 0:
                tmp_cnt += 1
                # ls.append(j)
                if tmp_cnt == 7:
                    break

        # print("i:" + str(i) + ", c:" + str(tmp_cnt) + ", l:" + str(ls))
        if tmp_cnt == 6:
            cnt += 1

    print(cnt)


main()

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()
    #約数の大きい順にソートしたい場合
    #divisors.sort(reverse=True)
    return divisors

ans=0
n=int(input())
for i in range(1,n+1):
    ans+=(len(make_divisors(i))==8 and i%2==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

def main():
    N = int(input())
    ans = 0
    for n in range(1, N+1, 2):
        #if len(make_divisors(n)) == 8:
        #    print('n:{}, divisors:{}'.format(n, make_divisors(n)))
        ans += (len(make_divisors(n)) == 8)
    
    print(ans)


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
c = 0
a = [105,165,195]
if (n<105):
    print(0)
elif (105<=n and n<135):
    print(1)
elif (n >= 195):
    print(5)
elif (135<=n and n<165):    
    print(2)
elif (165<=n and n<189):
    print(3)
else:
    print(4)

Submission status: Accepted

Solution code:
import math

n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
def count_div(n):
  res = 0
  for i in range(1, n + 1):
    if n % i == 0:
      res += 1
  return res
n = int(input())
ans = 0
for i in range(1, n + 1, 2):
  if count_div(i) == 8:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
def countYakusu(n):
  count = 0
  for i in range(n):
    if n % (i+1) == 0:
      count = count + 1
#      print(n,i+1)
#  if count == 8: print(n)
  return count == 8

N = int(input())
count = 0
for i in range(math.ceil(N/2)):
  count = count + countYakusu(i*2+1)
#  print(i*2+1)
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

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

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

    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=int(input())
def sosuu(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([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
c=0
for j in range(1,s+1,2):
  a=sosuu(j)
  b=1
  for i in range(len(a)):
    b *= (a[i][1]+1)
  if b==8:
    c+=1
print(c)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(1, n+1):
    if i%2:
        j = 1
        div = 0
        while j <= i:
            if i%j==0:
                div += 1
            j += 1
        if div == 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(i):
    if i % (j+1) == 0:
      cnt += 1
  if cnt == 8:
    ans += 1
print(ans)

Submission status: Accepted

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


def cnt(n: int):
    i = 1
    ans = 0
    while i * i < n:
        if n % i == 0:
            ans += 1
        i += 1
    ans *= 2
    if i * i == n:
        ans += 1
    return ans


def solve(N: int):
    print(sum(1 for i in range(1, N + 1, 2) if cnt(i) == 8))


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

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

print(sum(1 for i in range(1,N+1) if i % 2 >0 and f(i)==8))

Submission status: Accepted

Solution code:
n = int(input())


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


ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for n in range(1, N+1, 2):
    num = 0
    for m in range(1, n+1):
        num += n % m == 0
    ans += num == 8

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
def yaku(n):
    cnt = 0
    for k in range(1,n+1):
        if n%k==0:
            cnt += 1
    return cnt

cnt = 0
for n in range(1,N+1):
    if n%2==1 and yaku(n)==8:
        if yaku(n)==8:
            cnt += 1

print(cnt)

Submission status: Accepted

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

    # divisors.sort()
    return divisors
n = int(input())
ans = 0
for i in range(1,n+1,2):
    c = make_divisors(i)
    if len(c) == 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,n+1):
        if i % j == 0:
            cnt += 1
            if cnt > 8:
                break
    if cnt == 8:
        ans +=1
        

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=[105,135,165,189,195]
cnt=0
n=int(input())
for a in A:
    if a<=n:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
"""
https://atcoder.jp/contests/abc106/tasks/abc106_b
"""

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

    def count_divisor(n):
        """nの約数を数える"""
        cnt = 0
        i = 1
        while i*i <= n:
            if n%i == 0:
                cnt += 1
                if i != n//i:
                    cnt += 1
            i += 1
        return cnt

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
ans = 0
for i in range(-(-N//2)+1):
	cnt = 0
	for j in range(1, 2*i):
		if (2*i-1) % j == 0:
			cnt += 1

	if cnt == 8:
		ans += 1

print(ans)

Submission status: Accepted

Solution code:

N = int(input())
ans = 0

#Nの約数をdivisorsにぶちこむ
def Num_divisor(N):
    divisors = []
    for i in range(1,N):
        #調べるのはNの1/2乗まででよい
        if i * i > N:
            break
        if ( N % i == 0):
            #Nがiで割り切れたら約数は B と i
            B = N / i
            #Bとiが同じ時は一つだけ追加
            if B == i :
                divisors.append(B)
            else:
                divisors.append(B)
                divisors.append(i)
    return len(divisors)

for i in range(1,N+1):
    #奇数のとき
    if (i % 2) != 0:
        if Num_divisor(i) == 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:
    count=0
    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 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


res = []
N = int(input())
for i in range(1, N + 1):
    if i % 2 == 0:
        continue
    else:
        r = make_divisors(i)
        if len(r) == 8:
            res.append(i)
print(len(res))

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
lista = [0] * (n + 1)
for i in range(1, n + 1, 2):
    c = 1
    for j in range(1, i, 2):
        if i % j == 0:
            c += 1
    if c == 8:
        cnt += 1
print(cnt)
"""
# 奇数のみ
for i in range(1, n + 1, 2):
    # 3 * 1, 3 * 3, 3 * 5...
    for j in range(i, n + 1, 2 * i):
        lista[j] += 1
for i in range(n + 1):
    if lista[i] == 8:
        cnt += 1
print(cnt)
"""

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
lista = [0] * (n + 1)
# 奇数のみ
for i in range(1, n + 1, 2):
    # 3 * 1, 3 * 3, 3 * 5...
    for j in range(i, n + 1, 2 * i):
        lista[j] += 1
for i in range(n + 1):
    if lista[i] == 8:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for n in range(1, N+1, 1):
    count = 0
    if n%2==0:
        continue
    for i in range(1, int(n**0.5)+1):
        if n%i==0:  
            count = count + 2
    if count==8:
        ans = ans + 1

print(ans)

Submission status: Accepted

Solution code:
"""nを素因数分解"""
"""2以上の整数n => [(素因数, 指数), ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+1):
        if temp%i == 0:
            cnt = 0
            while temp%i == 0:
                cnt += 1
                temp //= i
            arr.append((i, cnt))
    if temp != 1:
        arr.append((temp, 1))
    if arr == []:
        arr.append((n, 1))
    return arr

n = int(input())
k = 0
for j in range(1, n+1):
    if j%2==1:
        li = factorization(j)
        l = []
        for (x, y) in li:
            l.append(y)
        count = 1
        for i in l:
            count *= i+1
        if count == 8:
            k += 1
print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    if n < 105:
        print(0)
        exit()
    i = 105
    ans = 0
    while i <= n:
        if i % 2 == 0:
            i += 1
            continue
        cnt = 0
        a = 1
        while a * a <= i:
            if i % a == 0:
                if i // a == a:
                    cnt += 1
                else:
                    cnt += 2
            a += 1
        #print(i,cnt)
        if cnt == 8:
            ans += 1
        i += 1
    print(ans)
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
import math
import itertools
import numpy as np

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

def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        if div(i) == 8 and i % 2 == 1:
            ans += 1
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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:
def input_number():
    return int(input())

def is_odd(number):
    if number % 2 == 1:
        return True
    else:
        return False

def is_8(number):
    fraction_of_the_number = 0
    for i in range(1, int(number**0.5) + 1, 2):
        if number % i == 0:
            fraction_of_the_number += 2
    if fraction_of_the_number == 8 and is_odd(number):
        return True
    else:
        return False

def main():
    n = input_number()
    answer = 0
    for i in range(1, n+1, 2):
        if is_8(i):
            answer += 1
    print(answer)

main()

Submission status: Accepted

Solution code:
import math

def input_number():
    return int(input())

def is_odd(number):
    if number % 2 == 1:
        return True
    else:
        return False

def is_8(number):
    fraction_of_the_number = 0
    for i in range(1, int(math.sqrt(number)) + 1, 2):
        if number % i == 0:
            fraction_of_the_number += 2
    if fraction_of_the_number == 8 and is_odd(number):
        return True
    else:
        return False

def main():
    n = input_number()
    answer = 0
    for i in range(1, n+1, 2):
        if is_8(i):
            answer += 1
    print(answer)

main()

Submission status: Accepted

Solution code:
#abc106_b.py
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

def has_eight_div(N):
#    print(len(make_divisors(N)) )
    if 8 == len(make_divisors(N)) and N%2==1:
        return 1
    return 0

N = int(input())
ans = 0
for i in range(N+1):
    ans += has_eight_div(i)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 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:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
ans = 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: ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
B = 0
for i in range(N):
  A = 0
  n = int((i+1)**(1/2))
  for j in range(n):
     if (i+1) % (j+1) == 0:
        A += 1
  if A == 4 and (i+1) % 2 == 1:
    B += 1
print(B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

for i in range(105, n + 1, 2):
    divisor = []
    for j in range(1, int(i ** 0.5) + 1):
        if i % j == 0:
            divisor.append(j)
            divisor.append(i // j)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a = 0
for x in range(1,n+1):
    if x%2 == 0: continue
    else:
        b=0
        for y in range(1,x+1):
            if x%y ==0:
                b+=1
        if b>= 8: a+=1
        
print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass #sortされていない

n = int(input())
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:
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:
import sys
n=int(input())
num=1
ans=0
while num<=n:
  count=0
  for i in range(num):
    i+=1
    if num%i == 0: count+=1
  if count == 8: ans+=1
  num+=2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#約数が8個の時、数の素因数を2^a, 3^b, ...とすると(a+1)*(b+1)*... = 8となる
#Nまでの素数を出す
N = int(input())
N_MAX = 200
prime = [1 for i in range(N_MAX+1)]
prime[0], prime[1] = 0, 0
for i in range(2, N_MAX+1):
    if prime[i] == 1:
        for j in range(2*i, N_MAX+1, i):
            prime[j] = 0
prime[2] = 0
ps = []
for i in range(N_MAX+1):
    if prime[i] == 1:
        ps.append(i)
pl = len(ps)
ans = 0
for i in range(pl):
    for j in range(i+1, pl):
        if (ps[i]**3)*ps[j] <= N or ps[i]*(ps[j]**3) <= N:
            ans += 1
        for k in range(j+1, pl):
            if ps[i]*ps[j]*ps[k] <= N:
                ans += 1
print(ans)