Problem:


Score: 200 points

Problem Statement

The number 105 is quite special - it is odd but still it has eight divisors.
Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?

Constraints

N is an integer between 1 and 200 (inclusive).

Input

Input is given from Standard Input in the following format:

N

Output

Print the count.

Sample Input 1

105

Sample Output 1

1

Among the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.

Sample Input 2

7

Sample Output 2

0

1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.



Sample input:
105


Sample output:
1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n=int(input())
count,cnt=0,0

for i in range(1,n+1,2):
  for j in range(1,math.ceil(i/2)):
    if i%j==0:
      count+=1
      
  if count+1==8:
    cnt+=1
    
  count=0
  
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def divisor_list(n):
    ret = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            ret.add(i)
            ret.add(n // i)
        i += 1
    return ret


N = int(input())

ans = 0
for i in range(N+1):
    A = divisor_list(i)
    oddcnt = 0
    for a in A:
        if a % 2 == 1:
            oddcnt += 1
    if oddcnt == 8:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

#約数列挙
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 = ni()
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:

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 = []
n = int(input())
for i in range(3,200,2):
    tmp = len(make_divisors(i))
    if tmp == 8:
        ans.append(i)
m = 0
for tmp in ans:
    if tmp <= n:
        m+=1
print(m)

Submission status: Accepted

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

ans = 0
n = int(input())
if(n >= 105):
    for i in range(105, n + 1, 2):
       divcnt = a(i)

       if (divcnt == 8):
           ans = ans + 1
    

print(0 if(n < 105) else ans)

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc106


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

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


print(main())

Submission status: Accepted

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

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation



'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''




'''
素数の判定
'''
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        #sqrt(n)+1以上は考えて約数はないので却下
        if n % k == 0:
            return False
            #割り切れたらFalse
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  # [1, 0, 3]

'''
def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''
'''
試し割り法で素因数の種類とその数を出してる
'''
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

########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

def main():

    steps=0
    state=0
    w=1
    j=0
    k=0
    sum=0
    ans=0
    n=int(input())
    for i in range(1,n+1,2):#これで1個飛ばしループになる
     #print(i)
     falis=factorization(i)
     #print(len(falis[:][0]),len(falis[:]),falis[:][0],falis)
     #print(len(falis[:]),falis)
     for j in range(len(falis[:])):#fails[:]#これで2次元の行数を求められる
             #print(falis[j][1])
             if sum==0:
              sum =falis[j][1]+1
             else:#どこで判定を取るかがすごく大切
              sum=sum*(falis[j][1]+1)
             #print("sum",sum)
     if sum==8:
         ans +=1
     sum=0
    print(ans)

    #a,b=map(int, input().split(" "))
    #nl=list(map(int, input().split(" ")))#数字の時
    #s=input()
    #a=[int(i) for i in s]#int取るとstrでも行ける
    #print(a)




    #if state in known_states and not flag: # state => 2 steps => 5
        #こうやってある要素がリストの中にあるか探すのか
    #print(f'steps: {steps}, state: {state}')
    #こう書いてあるとデバックしやすい

    #dp= [[0]*3 for i in range(5)]#列　行
    #dp用の0の入ったやつ
    #dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
    #print(dp)＃初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
    DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
    exdp=np.zeros((3,4)) # ３×４の２次元配列を生成。2次元ならこう
    #dtypeは指定しないとfloatになる
    #for i in range(n):#ちょっとした入力に便利
    #    a, b = map(int, input().split())
        #dp[i][0] += [a]
        #これだとintとlistをつなぐことになって不適
    #    dp[i] += [a]
    #    dp[i] += [b]
        #これはうまくいく
        #やり方はいろいろあるということ
    #print(dp)


    "1行1つの整数を入力を取得し、整数と取得する"
    #nl=list(map(int, input().split(" ")))#数字の時
    #print(number_list)
    "12 21 332 とか入力する時に使う"
    "1行に複数の整数の入力を取得し、整数として扱う"
    #brray=[list(map(int, input().split(" ")))for i in range(N)
    #print(brray)



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]#内包表記に慣れろ
    #print(pin_l)

    ls = ["a", "b", "c", "d", "e"]


    #print(ls[2:5])
    #スライスでの取得

    #print(ls[:-3])
    #一番左端から右から3番目より左まで取得

    #print(ls[:4:2])
    #スライスで1個飛ばしで取得
    #ないときは左端スタート
    #始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
    #print(ls[::2])
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=[0]*(n+1)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# 約数列挙
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 16:03:16 2020

@author: shinba
"""
import bisect

n = int(input())

A = [105,135,165,189,195]

print(bisect.bisect(A,n))

Submission status: Accepted

Solution code:
N = int(input())

def check8(n):
    cnt = 0
    for i in range(1,n+1):
        if n % i == 0:
            cnt += 1
    if cnt == 8:
        return True
    else:
        return False

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for n in range(1, N+1):
    cnt = 0
    if n % 2 == 1:
        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:
def divisor(x):
  i=1
  table = []
  while i * i <= x:
    if x%i == 0:
      table.append(i)
      table.append(x//i)
    i += 1
  table = list(set(table))
  return table

n=int(input())

ans=0
for i in range(1,n+1,2):
  cnt = len(divisor(i))
  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:
def get_dividers(n):
    low_dividers = {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}
    high_dividers = {n // divider for divider in low_dividers}
    return low_dividers | high_dividers


N = int(input())
print(len([i for i in range(105, N + 1, 2) if len(get_dividers(i)) == 8]))

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

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def count(x):
    cnt = 0
    for i in range(1, x + 1):
        if x % i == 0:
            cnt += 1
    return cnt

N = int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
import math

#素数か(x>=2)
def prime_check(x): #x>=2
    if x==2:
        return True,2
    elif x%2==0:
        return False,2
    else:
        limit=int(math.sqrt(x))
        for factor in range(3,limit+1,2):
            if x%factor==0:
                return False,factor
        return True,x

#素因数分解(x>=2)
def prime_factorization(x): #x>=2
    factor_list=[]
    factor_dictionary={}
    factor_set=set()
    judge,factor=prime_check(x)
    while True:
        factor_list.append(factor)
        if factor in factor_set:
            factor_dictionary[factor]+=1
        else:
            factor_dictionary[factor]=1
            factor_set.add(factor)

        if judge:
            return factor_list,factor_dictionary,factor_set
            break
        else:
            x//=factor
            judge,factor=prime_check(x)

#素因数の個数(x>=2)
def total_number_of_factors(x):
    List,Dict,Set=prime_factorization(x)
    Total=1
    while Set:
        factor=Set.pop()
        Total*=Dict[factor]+1
    return Total


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

Submission status: Accepted

Solution code:
import math

def prime_check(x): #x>=2
    if x==2:
        return True,2
    elif x%2==0:
        return False,2
    else:
        limit=int(math.sqrt(x))
        for factor in range(3,limit+1,2):
            if x%factor==0:
                return False,factor
        return True,x


def prime_factorization(x): #x>=2
    factor_list=[]
    factor_dictionary={}
    factor_set=set()
    judge,factor=prime_check(x)
    while True:
        factor_list.append(factor)
        if factor in factor_set:
            factor_dictionary[factor]+=1
        else:
            factor_dictionary[factor]=1
            factor_set.add(factor)

        if judge:
            return factor_list,factor_dictionary,factor_set
            break
        else:
            x//=factor
            judge,factor=prime_check(x)


N=int(input())
ans=0
for i in range(1,N+1,2):
    List,Dict,Set=prime_factorization(i)
    Total=1
    while Set:
        element=Set.pop()
        Total*=Dict[element]+1
    if Total==8:
        ans+=1

print(ans)

Submission status: Accepted

Solution code:
def solve(N):
    ret = 0
    for i in range(3, N + 1, 2):
        div = 0
        for j in range(1, i + 1, 2):
            div += 1 if not i % j else 0
            if 8 < div:
                break
        ret += 1 if div == 8 else 0
    return ret

if __name__ == '__main__':
    N = int(input())
    print(solve(N))

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

Submission status: Accepted

Solution code:
n=int(input())
cc=0
for i in range(1,n+1,2):
    c=0
    for s in range(1,i+1):
        if i%s==0:
            c+=1
    if c==8:
        cc+=1
print(cc)

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 j * j > i : break
        if j * j == i : cnt += 1
        elif i % j == 0 : cnt += 2

    if cnt == 8 : ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

def yakusu(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==1 and yakusu(i)==8:
        ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for num in range(1, N+1):
    cnt = 0
    for i in range(1, num+1):
        if num%2==1 and num%i==0:
            cnt += 1
    if cnt >= 8:
        count += 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

res=0

for i in range(1,n+1):
    cnt=0
    if i%2==0:
        continue
    else:
        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
for i in range(1,n+1,2): #1以上n以下の奇数iについて考えます
    prime = 1 #それ自身を含む
    for j in range(1,i//2):
        if i % j == 0:
            prime += 1
    if prime == 8:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())


from math import sqrt

def divisor(num):
    max_num = int(sqrt(num))
    divisor_list = []
    for i in range(1, max_num + 1):
        if num % i == 0:
            divisor_list.append(i)
            divisor_list.append(num//i)
    sorted_divisor_list = sorted(divisor_list)
    return sorted_divisor_list

count=0
for num in range(1, n+1):
    if num % 2 == 0:
        continue
    if len(divisor(num)) == 8:
        count+=1

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()

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

Submission status: Accepted

Solution code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()

ans=0
for k in range(105,n+1,2):
    c=0
    for i in range(1,int(k**0.5)+1):
        if k%i==0:
            c+=2
    if i**2==k:
        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, 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:
import fileinput

n = int(input())

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

print(c)

Submission status: Accepted

Solution code:
def trial_divide(n):
    ret = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if n // i == i:
                ret += 1
            else:
                ret += 2
    return ret
        
def main():
    n = int(input())
    count = 0
    for i in range(1, n+1):
        if i % 2:
            if trial_divide(i) == 8:
                count += 1
    print(count)
        
if __name__=='__main__':
    main()

Submission status: Accepted

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

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 n in range(1,N+1):
  div = make_divisors(n)
  if len(div) == 8 and n%2 != 0:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = [i for i in range(1,N+1) if i%2 != 0]
ans = 0
for i in L:
    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())
cnt=0

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

# 約数の数を出してくれる
def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return len(divisors)

cnt = 0
# 1からNまでの奇数
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())

res = 0

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

print(res)

Submission status: Accepted

Solution code:


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

    # 奇数の数列生成
    odd = [i for i in range(1, n+1, 2)]

    res = 0
    for i in odd:
        cnt = 0
        for j in range(1, i+1, 2):
            if i % j == 0:
                cnt += 1
        if cnt == 8:
            res += 1
    print(res)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

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

    

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

ans = 0
for i in range(105, 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())
ans = 0
for i in range(1, n + 1, 2):
    m = 1
    num = i
    for j in range(2, n + 1):
        cnt = 0
        while num % j == 0:
            num //= j
            cnt += 1
        m *= (cnt + 1)
    if m == 8:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def solve(n: int):
    count = 0
    for k in range(1, n + 1, 2):
        num_aliquot = len([1 for j in range(1, k + 1) if k % j == 0])
        if num_aliquot == 8:
            count += 1

    return count


N = int(input())  # 1 <= N <= 200

print(solve(N))

Submission status: Accepted

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


def f(n):
    '''
    >>> f(105)
    8
    '''
    ret = 0
    for i in range(1, n+1):
        if n % i == 0:
            ret += 1
    return ret

def solve(N: int):
    ret = 0
    for i in range(1, N+1):
        if i % 2 == 1 and f(i) == 8:
            ret += 1
    return ret

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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
    print(solve(N))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()

Submission status: Accepted

Solution code:
n = int(input())
nn = [i for i in range(1, n+1) if i%2==1]
ans = 0
for i in range(1, n+1, 2):
    cnt = []
    t = 0
    for j in nn[:-2]:
        for k in nn[1:]:
            if j*k==i: cnt.extend([j, k])
    if len(set(cnt))==8:
        ans+=1
        
print(ans)

Submission status: Accepted

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

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:
n=int(input())
nm=[0]*(n+1)

for i in range(1,n+1):
    for j in range(1,n+1):
        if i%j==0:
            nm[i]+=1
l=[1 for i in range(1,n+1) if nm[i]==8 and i%2]
print(sum(l))