QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692281#9248. An Easy Math ProblemKeeperHihi#TL 0ms3840kbC++20776b2024-10-31 14:15:262024-10-31 14:15:29

Judging History

This is the latest submission verdict.

  • [2024-10-31 22:36:43]
  • hack成功,自动添加数据
  • (/hack/1098)
  • [2024-10-31 22:13:58]
  • hack成功,自动添加数据
  • (/hack/1096)
  • [2024-10-31 22:00:43]
  • hack成功,自动添加数据
  • (/hack/1095)
  • [2024-10-31 14:15:29]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 3840kb
  • [2024-10-31 14:15:26]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

void solve() {
	i64 n;
	cin >> n;
	vector<i64> p;
	for (i64 i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			p.emplace_back(i);
			if (i * i != n) {
				p.emplace_back(n / i);
			}
		}
	}
	sort(p.begin(), p.end());
	int m = p.size();
	unordered_set<long double> set;
	for (int i = 0; i < m; i++) {
		int t = lower_bound(p.begin(), p.end(), p[i] * p[i]) - p.begin();
		for (int j = t; j < m; j++) {
			if (p[j] % p[i] == 0) {
				set.insert(1.L * p[i] * p[i] / p[j]);
			}
		}
	}
	cout << set.size() << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int t = 1;
	cin >> t;

	while (t--) {
		solve();
	}

	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3840kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

1
2
2
3
2
5
2
4
3
5

result:

ok 10 lines

Test #2:

score: -100
Time Limit Exceeded

input:

2000
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
646969323...

output:


result: