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:
def make_div_list(num):
    div_list=[]
    for i in range(1, int(num**0.5)+1):
        if num%i==0:
            div_list.append(i)
            if i!=num//i:
                div_list.append(num//i)
    
    div_list.sort()
    return div_list

n=int(input())
if n<=104:
    print(0)
else:
    ans=1#105
    for num in range(107, n+1):
        if num%2==1:
            l=make_div_list(num)
            if len(l)==8:
                ans+=1
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = [0 for n in range(N+1)]

for n in range(1,N+1, 2):
  for i in range(n, N+1, n):
    ans[i] += 1

print(ans.count(8))

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import math

n = int(input())
li = [105, 135, 165, 189, 195]
cnt=0
for i in li:
    if (n >= i):
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if (n < 105):
    ans = 0
elif (n == 105):
    ans = 1

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


# ワーシャルフロイド (任意の2頂点の対に対して最短経路を求める)
# 計算量n^3 (nは頂点の数)
def warshall_floyd(d, n):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d


# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
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

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定



# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
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:
# -*- coding: utf-8 -*-
"""
Created on Fri May  8 01:14:23 2020

@author: Kanaru Sato
"""
import math

N = int(input())
ans = 0

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

print(ans)

Submission status: Accepted

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

for i in range(1, N + 1, 2):
  cnt = 0
  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())
res = 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:
      res += 1

print(res)

Submission status: Accepted

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

    counter = 0


print(ans)

Submission status: Accepted

Solution code:
#ABC106B
def main():
    import sys
    N = int(sys.stdin.readline())
    result = 0
    
    for i in range(1, N+1, 2):
        result +=yakusu_cnt(i)
    print(result)
    
def yakusu_cnt(n):
    ans = 0
    for i in range(1, n+1):
        if n%i==0:
            #print(i)
            ans+=1
    if ans ==8:
        return 1
    else:
        return 0


if __name__=='__main__':
    main()

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    def calc_div(i):
        num = 0
        for j in range(1, i + 1, 2):
            if i % j == 0:
                num += 1
        return num

    n = ii()
    cnt = 0
    for i in range(1, n + 1, 2):
        if calc_div(i) == 8:
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
def divisor(n):
    a = set()
    for i in range(1, math.ceil(n**0.5) + 1):
        if n % i == 0:
            a.add(i)
            a.add(n // i)
    return a

n = int(input())

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

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:
def main():
    n = int(input())
    ans = solve(n)
    print(ans)


def solve(n):
    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
    return ans


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

#約数を返す関数
def yaku(n):
  x = 0
  for i in range(1,n+1):
    if(not n%i):
      x += 1
  return x

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N = ri()
ans = 0
for n in range(1, N + 1, 2):
    tmp = 0
    for i in range(1, n + 1):
        if n % i == 0:
            tmp += 1
    if tmp == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = [0] * 100
b = [0] * 100
ans = 0

for i in range(100):
    a[i] = 2 * i + 1

for i in range(100):
    for j in range(2, 200):
        if a[i] % j == 0:
            b[i] += 1

for k in range(100):
    if b[k] == 7 and a[k] <= n:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
i=1
ans=0
while i<=n:
    x=1
    count=0
    while x<=n:
        if i%x==0:
            count+=1
        x+=1
    if count==8: ans+=1
    i+=2
print(ans)

Submission status: Accepted

Solution code:
# maxNum = int(input())
# print(maxNum//2)
# num = 1

# ans = 0
# while num <= maxNum:  
#     yakusu = 0
#     for i in range(maxNum//2):
#         yakusu = 0
#         if (i == 0) or (i == 1):
#             continue
#         if maxNum % i == 0:
#             yakusu += 1
#     if yakusu == 8:
#         ans += 1
#     num += 1

# print(ans)

maxNum = int(input())
i = 1
ansNum = 0
# ある数の約数を調べる
while i <= maxNum:
    numOfYakusu = 0

    warukazu = 1
    while warukazu <= i:
        # 偶数の場合
        if i % 2 == 0:
            break
        if i % warukazu == 0:
            numOfYakusu += 1
        warukazu += 1
        # print(warukazu)
    # print("i = {} , numOfYakusu = {}".format(i, numOfYakusu))
    if numOfYakusu == 8:
        ansNum += 1
    i += 1

# print("ansNum : {}".format(ansNum))
print(ansNum)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
def count(x):
    c=0
    i=1
    while i<=x:
        if x%i==0:
            c+=1
        i+=1
    return c
for i in range(105,N+1,2):
    if count(i)==8:
        ans+=1
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect

n = int(input())

a = []
for i in range(100):
    s = 0
    for j in range(1, int(((i*2+1)**(0.5)//1)+1)):
        if (i*2+1)%j == 0:
            s += 1
            if int((i*2+1)/j) != j:
                s += 1
    #print(s)
    if s == 8:
        a.append(i*2+1)
        
ans = bisect.bisect_right(a, n)
print(ans)
#print(a)

Submission status: Accepted

Solution code:
def is_div_8(x):
    if x % 2 == 0:
        return False
    count = 0
    for j in range(1, x + 1):
        if x % j == 0:
            count += 1
    if count == 8:
        return True
    else:
        return False


N = int(input())
count = 0
for i in range(1, N + 1):
    if is_div_8(i):
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
lng = 0
for i in range(1,n+1,2):
  count= 0
  for p in range(1,n+1):
    if i%p == 0:
      count += 1
  if count == 8:
    lng += 1
print(lng)

Submission status: Accepted

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

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

count = 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:
        count += 1
else:
    print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input()) 
def make_divisors(n):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    return div
ans = 0
for i in range(1, n + 1):
    if i % 2 != 0:
        div = make_divisors(i)
        if len(div) == 8:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

Submission status: Accepted

Solution code:
a=int(input());print(sum(a>ord(x)for x in'h¤¼Â'))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input());print(sum(ord(x)<a for x in"h¤¼Â"))

Submission status: Accepted

Solution code:
_=int(input());print(sum(ord(x)<_ for x in "h¤¼Â"))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    r = 0
    for i1 in range(1, n + 1,2):
        cnt = 0
        for i2 in range(1,i1+1):
            cnt += i1 % i2 == 0
        r += cnt == 8
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def I(): return int(input())
N = I()
ans = 0

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

Submission status: Accepted

Solution code:
n=int(input());print(max(n-75,0)//30+int(n>188))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
k=0
tmp=1
ans=0
for n in range(3,N+1,2):
    for i in range(2, n + 1):
        while n % i == 0:
            n //= i
            k += 1
        tmp *= k+1
        k = 0
    if tmp==8:
        ans+=1
    tmp=1
print(ans)

Submission status: Accepted

Solution code:
_=int(input());c=0
for i in 'i¥½ÃÉ':
  if (_ < ord(i)):
    print(c)
    break
  c+=1

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 len(make_divisors(i)) == 8 and i%2 == 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

X = [int(x) for x in range(1,n+1,2)]

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

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  ans = 0
  
  for i in range(3, N+1, 2): #1は調べる必要がない
    count = 2 # 1と自分

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

  print(ans)

if __name__ == "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

X = [int(x) for x in range(1,n+1,2)]

answer = []
cnt = 0
for x in X:
    answer = []
    for i in range(1,n+1):
        if x % i == 0:
            answer.append(i)

    if len(answer) == 8 :
        cnt += 1 
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

Solution code:
# B - 105

N = int(input())

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

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

Submission status: Accepted

Solution code:
# B - 105

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

def calc(N):
    ret = 2
    M = int(N ** 0.5) + 1
    for i in range(2, M):
        if N % i == 0:
            ret += 2
    return ret

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

Submission status: Accepted

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

if n >= 105:
    for i in range(105, n+1, 2):
        count_yakusuu = 0
        for j in range(1, int(i**0.5)+1):
            if i % j == 0:
                count_yakusuu += 2
        if count_yakusuu == 8:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
# 02 AtCoder Beginner Contest 106 B - 105
import sys
import math

N = int(input())


def divisor(n):
    ans = 0
    for i in range(1, int(math.sqrt(n + 1)), 2):  # 偶数は回答に含めないため、約数が　2の倍数となる数字は存在しない
        if n % i == 0:
            ans += 1
            if i != int(math.sqrt(n + 1)):
                ans += 1

    return ans


ans = 0
for i in range(105, N + 1, 2):  # 偶数は回答に含めない
    if divisor(i) == 8:
        ans +=1

print(ans)

Submission status: Accepted

Solution code:
# 02 AtCoder Beginner Contest 106 B - 105
import sys
import math

N = int(input())


def divisor(n):
    ans = 0
    for i in range(1, n + 1, 2):  # 偶数は回答に含めないため、約数が　2の倍数となる数字は存在しない
        if n % i == 0:
            ans += 1
            # if i != int(math.sqrt(n)):
            #     ans += 1

    return ans


ans = 0
for i in range(105, N + 1, 2):  # 偶数は回答に含めない
    if divisor(i) == 8:
        ans +=1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, n+1):
    if i % 2 == 1:
        l = []
        for d in range(1, i+1):
            if i % d == 0:
                l.append(d)
                if len(l) == 8:
                    cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

def unique(w):
    d = {}
    for c in w:
        if c in d.keys():
            d[c] += 1
        else:
            d.setdefault(c, 1)
    return list(d.keys()), list(d.values())

def number_of_divisor(n):
	import numpy as np
	result = []
	while n > 1:
		div = divisor(n)
		result.append(div)
		n //= div
	index, result = unique(result)
	result = [x + 1 for x in result]
	return np.prod(result)

def divisor(n):
    if n % 2 == 0:
        return 2
    elif n % 3 == 0:
        return 3
    maxitr = intSqrt(n)
    i = 1
    while True:
        i += 4
        if i > maxitr:
            return n
        elif n % i == 0:
            return i
        i += 2
        if i > maxitr:
            return n
        elif n % i == 0:
            return i

def intSqrt(n):
    x = 1
    while True:
        x2 = (x + n // x) // 2
        if x2 ** 2 <= n and abs(x - x2) <= 1:
            break
        x = x2
    return x2

def ABC106B(n):
    count = 0
    for i in range(3, n+1, 2):
        if number_of_divisor(i) == 8:
            count += 1
    print(count)

n = int(input())
ABC106B(n)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
if n < 105:
    print(0)
    quit()
elif n == 105:
    print(1)
    quit()
else:
    ans = 1
    for i in range(107, 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)