为啥WA,样例过了
查看原帖
为啥WA,样例过了
947029
Chen_Three楼主2024/7/30 11:03
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int a[1000005];
bool isping(int n) {
	return (int)(sqrt(n)) * (int)(sqrt(n)) == n;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, p = 0;
	cin >> n;
	for (int i = 1; i <= sqrt(n); i++) {
		if (!(n % i)) {
			if (i == 1) {
				cout << i;
				a[++p] = i;
			} else {
				cout << endl << i;
				a[++p] = i;
			}
		}
	}
	for (int i = p - isping(n); i >= 1; i--) {
		cout << endl << n / a[i];
	}
	return 0;
}

2024/7/30 11:03
加载中...