我从未见过如此厚颜无耻的题

xtu 1242
一开始想法有暴力出所有的2,3,5,7,11,13的组合情况,不包括其它的因子以为可以弄出连续区间,后来发现并不可以。
好吧是我好久没遇到打表题了,想了半天不知道怎么搞- -,原来是打表
用超过的时间打出需要的表,才是打表的精华- -,这里直接打肯定是不行的内存不够。
所以要分块,剩余部分直接暴力算。
其实好像有其它更好的方法。。。不过我太笨?

bool ok(int x) {
	int c = 0;
	for (int i = 0;i < 6;i++) {
		while (x%a[i]==0) {
			x /= a[i];
			c++;
		}
	}
	return c % 2 == 0;
}
int main() {
	int t;cin >> t;
	while (t--) {
		int n;cin >> n;
		int ans = b[n / 200000];
		for (int i = n / 200000 * 200000 + 1;i <= n;i++) {
			if (ok(i)) {
				ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}
原文地址:https://www.cnblogs.com/HaibaraAi/p/4600636.html