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

count = 0
divisors = 0

arrays = []
for i in range(n+1):
    arrays.append(False)

for i in range(n+1):
    if i % 2 == 1:
        divisors = 0
        for j in range(len(arrays)):
            arrays[j] = False
        for j in range(1,i+1):
             if i % j == 0:
                 arrays[j] = True
        for j in range(len(arrays)):
            if arrays[j]:
                divisors += 1
        if divisors == 8:
            count += 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())

divcnt = {n: 0 for n in range(1, (n + 1), 2)}
for i in range(1, (n + 1), 2):
    for j in range(i, (n + 1), (i * 2)):
        divcnt[j] += 1

ans = 0
for i in divcnt:
    if divcnt[i] == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

odd_prime = [3,5,7,11,13]
ans = 0
#2*2*2=8
for i in range(3):
    for j in range(i+1,4):
        for h in range (j+1,5):
            if odd_prime[i] * odd_prime[j] * odd_prime[h] <= n:
                ans += 1
#4*2=8
for i in range(1,5):
    if 3**3 * odd_prime[i] <= n:
        ans += 1
        
print(ans)

Submission status: Accepted

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

N = int(readline())

def count_div(x):
  div = set()
  for i in range(1, int(x ** 0.5) + 1):
    if x % i == 0:
      div.add(i)
      div.add(x // i)
  return len(div)

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 itertools
N = int(input())
S = [3,5,7,11,13]

if N >= 189:
  ans = 2
elif N>= 135:
  ans = 1
else:
  ans = 0
A = list(itertools.combinations(S,3))
#print(A)
for x in A:
  a,b,c = x
  if a*b*c <= N:
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    cnt = 0
    n = int(input())
    for i in range(1,n+1,2): # 奇数だけ繰り返す
        k = 0
        for m in range(1,i+1):
            if i % m == 0:
                k += 1
        if k == 8:
            cnt += 1
    print(cnt)

if __name__=="__main__":
    main()

Submission status: Accepted

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

def main():
    cnt = 0
    n = int(input())
    for i in range(1,n+1):
        if i % 2 == 1: # 奇数判定
            k = 0
            for m in range(1,i+1):
                if i % m == 0:
                    k += 1
            if k == 8:
                cnt += 1
    print(cnt)

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
res = 0
for num in range(1, N + 1):
    if num % 2 == 1:
        cnt = 0
        for d in range(1, num + 1):
            if num % d == 0:
                cnt += 1
                if cnt > 8:
                    break
        if cnt == 8:
            res += 1
print(res)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
def sympy(num):
  l = []
  for i in range(1, num+1):
    for j in range(1, num+1):
      if (i % 2 != 0) and (i*j == num):
        l.append(i)
  return l
for i in range(1, n+1):
  l = sympy(i)
  if (i % 2 != 0) and (len(l) == 8):
    cnt += 1
print(cnt)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N = int(input())

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

Submission status: Accepted

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

n = int(input())


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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

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())
print(len(list(filter(lambda x: len(make_divisors(x)) == 8, range(1, n + 1,2)))))

Submission status: Accepted

Solution code:
#template
def inputlist(): return [int(j) for j in input().split()]
#template
def divisore(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(reverse=True)
    return divisors
N = int(input())
ans = 0
for i in range(1,N+1):
    if i % 2 == 0:
        continue
    li = divisore(i)
    if len(li) == 8:
        ans +=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
def divisor(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):
    res = divisor(i)
    if len(res) == 8:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
xList = [105,135,165,189,195]
answer = 0
for i in xList:
    if i <= N:
        answer += 1
print(answer)

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
ans=0
for i in range(1,n+1,2):
    s=set()
    for j in range(1,int(pow(i,0.5)+1)):
        if i%j==0:
            s.add(j)
            s.add(i//j)
    if len(s)==8:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
def make_divisors(n):
    divisors = []
    # 試し割りで、かつ積でnを作るときの相方も同時に追加してる
    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,2):
    if len(make_divisors(i)) == 8:
        ans += 1
print(ans)

Submission status: Accepted

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


def divisors(num):
    array = []
    limit = int(num ** 0.5) + 1
    for i in range(1, limit):
        if num % i == 0:
            div1 = i
            div2 = num//i
            array.append(div1)
            if div1 != div2:
                array.append(div2)
    array.sort()
    return array


def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1, 2):
        count = len(divisors(i))
        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(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())

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

result = 0
for i in range(n):
    num = i*2
    if num > n:
        break
    hasndivisors = 0
    for divisor in range(n):
        # print(num+1, divisor+1)
        if (num+1)/(divisor+1) == (num+1)//(divisor+1):
            hasndivisors += 1
    # print(num+1, 'has', hasndivisors, 'divisors')
    if hasndivisors == 8:
        result += 1

print(result)

Submission status: Accepted

Solution code:
n = int(input())
counter = 0
for i in range(1, n+1, 2):
    divisor_counter = 0
    for j in range(1, i+1):
        if i % j == 0:
            divisor_counter += 1

    if divisor_counter == 8:
        counter += 1
print(counter)

Submission status: Accepted

Solution code:
N = int(input())

if N < 105:
  ans = 0
elif N == 105:
  ans = 1
else:
  ans = 1
  for n in range(106, N+1):
    if n % 2 == 0:
      continue
    count = 0
    for i in range(1, int(n**(1/2))+1):
      if n % i == 0:
      	count += 1
    if count == 4:
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
prime = [3, 5, 7, 11, 13, 17]
N = int(input())
ans = 0
for i in range(1, N+1, 2):
    a = 1; x = i
    for j in range(6):
        n = prime[j]    #; print(i, n)
        w = 0
        while x%n == 0:
            x = x//n
            w += 1 
        a *= w + 1
        if x  == 1:
            break
    if a == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def factorization(n):
    retlist = []
    tmp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retlist.append([i, cnt])

    if tmp != 1:
        retlist.append([tmp, 1])

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

    return retlist

n = int(input())
ans = 0
for i in range(1,n+1,2):
    d = factorization(i)
    count = 1
    for k,val in d:
        count *= val+1
    if count == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

# B - 105 /
# 実行時間制限: 2 sec / メモリ制限: 1000 MB
# 配点: 200点

# 問題文
# 105という数は, 非常に特殊な性質を持つ - 奇数なのに, 約数が 8 個もある.
# さて, 1 以上 N 以下の奇数のうち, 正の約数を ちょうど 8個持つようなものの個数を求めよ.

# 制約
#     Nは 1 以上 200以下の整数

# 入力
# 入力は以下の形式で標準入力から与えられる.
# N

# 出力
# 条件を満たす数の個数を出力しなさい.

# 入力例 1
# 105

# 出力例 1
# 1

# 1以上 105 以下の整数の中で, ただ一つの「奇数かつ約数が 8 個」を満たす数は 105である.

# 入力例 2
# 7

# 出力例 2
# 0

# 1は約数が 1 個, 3, 5, 7 は全て素数なので約数が 2 個である. よって前述の条件を満たすような数は存在しない. 


def calculation(lines):
    # A, B = list(map(int, lines[0].split()))
    N = int(lines[0])
    cnt = 0
    for i in range(N+1):
        if i % 2 == 1:
            if get_yakusu_cnt(i) == 8:
                cnt += 1
    return [cnt]


def get_yakusu_cnt(n):
    # 3
    if n % 81 == 0:
        n3 = 4
    elif n % 27 == 0:
        n3 = 3
    elif n % 9 == 0:
        n3 = 2
    elif n % 3 == 0:
        n3 = 1
    else:
        n3 = 0
    # 5
    if n % 125 == 0:
        n5 = 3
    elif n % 25 == 0:
        n5 = 2
    elif n % 5 == 0:
        n5 = 1
    else:
        n5 = 0
    # 7
    if n % 49 == 0:
        n7 = 2
    elif n % 7 == 0:
        n7 = 1
    else:
        n7 = 0
    # 11
    if n % 121 == 0:
        n11 = 2
    elif n % 11 == 0:
        n11 = 1
    else:
        n11 = 0
    # 13
    if n % 169 == 0:
        n13 = 2
    elif n % 13 == 0:
        n13 = 1
    else:
        n13 = 0
    return (n3+1)*(n5+1)*(n7+1)*(n11+1)*(n13+1)


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['105']
        lines_export = [1]
    if pattern == 2:
        lines_input = ['7']
        lines_export = [0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
def cnt_div(n):
    div = []
    for i in range(1,int(math.sqrt(n)+2)):
        if n%i == 0:
            div.append(i)
            div.append(n//i)
    if len(set(div)) == 8:
        return 1
    else:
        return 0
n = int(input())
ans = 0
for i in range(1,n+1,2):
    ans += cnt_div(i)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

# 3 5 7 11 13
# 105 135 165 189 195
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:
n = int(input())
cnt = 0
for m in range(1,n+1,2):
    if len([i for i in range(1,m+1) if m%i==0])==8:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	n = int(input())

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

	print(cnt)

Submission status: Accepted

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

ans=0
for x in range(n+1):
  if x%2==1:
    
    s=make_divisors(x)
    if len(s)==8:
      ans+=1
    
print(ans)

Submission status: Accepted

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


def divisors(n):
    set_div = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            set_div.add(i)
            set_div.add(n//i)
    return set_div


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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

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

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())
res = 0
def checkOdd(N):
  k = 0
  for i in range(1,N+1):
    if N % i ==0:
      k += 1
  if k == 8:
    return True
  else:
    return False
 
if N<104:
  print(res)
else:
  for i in range(105,N+1,2):
    if checkOdd(i):
      res += 1
  print(res)

Submission status: Accepted

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

def main():

    N = int(input())

    ans = 0

    for i in range(1, N+1):
        if i % 2 == 1:

            count = 0

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# 引数nが持つ正の約数の数を調べる
def divisor_count(n:int) -> int:
  count = 0
  for x in range(1, n+1):
    if n % x == 0:
      count += 1
  
  return count

def solve(n: int) -> int:
  # [1..N]内で奇数かつ約数をちょうど8個持つ数字の数
  result = 0
  for x in range(1, n+1, 2):
    if divisor_count(x) == 8:
      result += 1
  return result
  
N = int(input())
print(solve(N))

Submission status: Accepted

Solution code:
# 引数nが持つ正の約数の数を調べる
def divisor_count(n:int) -> int:
  count = 0
  for x in range(1, n+1):
    if n % x == 0:
      count += 1
  
  return count

def solve(n: int) -> int:
  # [1..N]内で奇数かつ約数をちょうど8個持つ数字の数
  result = 0
  for x in range(1, n+1):
    if x&1 and divisor_count(x) == 8:
      result += 1
  return result
  
N = int(input())
print(solve(N))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for n in range(1, N+1):
    if n%2 == 1:
        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())
a = [0 for _ in range(N + 10)]

for i in range(1, N + 5):
    temp = i
    while(temp <= N):
        a[temp] += 1
        temp += i
ans = 0
for i in range(1, N + 1, 2):
    if a[i] == 8:  ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

score=0

for i in range((n+1)//2):
    i=i*2+1
    yakusuu1 = []
    yakusuu2 = []
    d=1
    while d*d <= i:
        if i%d==0:
            yakusuu1.append(d)
            
            if d!= i//d: #べき乗ではなかったら　ex:2*2=4
                yakusuu2.append(i//d)
        
        d=d+1
    yakusuu = yakusuu1+yakusuu2[::-1]
    # print(i,yakusuu)
    
    if len(yakusuu) == 8:
        score = score+1
print(score)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for n in range(1,int(N/2)+1):
    if 2*n+1 > N:
        break
    for i in range(1,int(N**(1/2)/2)+1):
        for j in range(i+1,int(N**(1/2)/2)+1):
            for k in range(j+1,int(N**(1/2)/2)+1):
                if 2*n+1 == (2*i+1)*(2*j+1)*(2*k+1):
                    ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def main():
    n = int(sys.stdin.readline())

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

    dp = [0] * 201
    ans = 0

    for i in range(1, n + 1):
        for j in range(105, n + 1):
            if j % i == 0:
                dp[j] += 1

    for i in range(105, n + 1, 2):
        if dp[i] >= 8:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def divisors(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

def main():
    N = int(readline())
    ans = 0
    for i in range(1,N+1,2):
        div = divisors(i)
        if len(div)==8:
            ans += 1

    print(ans)




if __name__ == '__main__':
    main()

Submission status: Accepted

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

# 求解処理
ans = 0
for n in range(1, N + 1, 2):
    div_count = 0
    for i in range(1, n + 1):
        div_count += (n % i == 0)

    ans += (div_count == 8)

# 結果出力
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
全探索
"""
n = int(input())
ans = 0
for num in range(1,n+1) :
    count = 0
    for i in range(1,num+1) :
        if num%i == 0 :
            count += 1
    if count == 8 and num%2 :
        ans += 1
print(ans)

Submission status: Accepted

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

N = int(input())


def is_8(num):
    if num < 1:
        return False
    elif num == 1:
        return False
    else:
        divisor_list = set()
        divisor_list.add(1)
        # root nまで見れば問題ない
        for i in range(2, int(math.sqrt(num)) + 1):
            if num % i == 0:
                divisor_list.add(num // i)
                divisor_list.add(i)
        # 元の数を入れる
        divisor_list.add(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:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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(readline())
l = []
for i in range(n+1):
    if len(make_divisors(i)) == 8 and i % 2 == 1:
        l.append(i)
print(len(l))

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:
import math
def yakusu(n):
    count = 0
    for i in range(1,int(math.sqrt(n))+1+1):
        if n % i == 0:
            count += 2
    return count
N = int(input())
c = 0
for i in range(1,N+1,2):
    if yakusu(i) == 8:
        c+=1

print(c)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
total_count = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	n = int(input())

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

	print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N >= 195:
    ans = 5
elif N >= 189:
    ans = 4
elif N >= 165:
    ans = 3
elif N >= 135:
    ans = 2
elif N >= 105:
    ans = 1
else:
    ans = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

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

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:
n = int(input())
ans = 1
b = 0
if n < 105:
  print(0)
elif n == 105:
  print(1)
else:
  for i in range(106,n+1):
    b = 0
    for j in range(1, i+1,2):
      if i % j ==0:
        b +=1
    if b == 8:
      ans += 1
  print(ans)

Submission status: Accepted

Solution code:
import sys


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    cnt = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            cnt[j] += 1
    ans = len([i for i in range(1, n + 1, 2) if cnt[i] == 8])
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def 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())
cnt=0
for i in range(1,n+1,2):
    if len(divisors(i))==8:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
def mkdiv(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]
ans=0
n=int(input())

for i in range(n+1):
  if len(mkdiv(i))==8 and i%2:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
import math
def main():
  n = int(input())
  array=[]
  ans=0
  for i in range(1,n+1,2):
    num=0
    for j in range(1,i+1,2):
      if i%j==0:
        num+=1
    if num==8:
      ans+=1
  print(ans)
main()

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0
def primes(num):
  arr = []
  for i in range(1,int(num*(0.5))+1):
    if num%i == 0 and i not in arr:
      arr.append(i)
      if num//i not in arr:
        arr.append(num//i)
  return arr
      
for i in range(1,n+1,2):
  if len(primes(i))==8:
    cnt += 1
print(cnt)

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

count = 0

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

Submission status: Accepted

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

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

print(ans)