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.

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}

typedef pair<int, int> P;
int main(){
	int N;
	cin >> N;

	int ans = 0;
	for(int i=1; i<=N; i+=2){//奇数のみでよいので i+=2
		//iについて素因数分解する
		vector<P> vec; //vec[i].first: 素因数pの値, second: pの個数
		int tmp = i;
		for(int j=2; j*j<i; j++){
			int cnt = 0;
			while(true){
				if(tmp % j != 0) break;
				tmp /= j;
				cnt++;
			}
			vec.emplace_back(j, cnt);
		} 

		int num = 1;//iの約数の個数 (= 素因数分解のそれぞれの素数の方の値+1の積)
		for(int j=0; j<vec.size(); j++){
			num *= vec.at(j).second + 1 ;
		}
		if(num == 8) ans++;
		// if(num == 8){
		// 	cout << i << ":  ";
		// 	for(int j=0; j<vec.size(); j++){
		// 		for(int k=0; k<vec.at(j).second; k++){
		// 			cout << vec.at(j).first << "  ";
		// 		}
		// 	}cout << endl;
		// }
	}

	cout << ans << endl;

}