TLE#4-6
查看原帖
TLE#4-6
989399
louzezhong20130517楼主2024/6/9 22:25
#include <bits/stdc++.h>
using namespace std;

unsigned long long qpow( unsigned long long a, unsigned long long n) {
	unsigned long long ans = 1;
	while (n) {
		if (n & 1)
			ans *= a;
		a *= a;
		n >>= 1;
	}
	return ans;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	unsigned long long n, x;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		x = i;
		for (int j = 1; j <= n; j++) {
			if (qpow(j, 2) ==  n * x) {
				cout << x;
				return 0;
			}
		}
	}
	return 0;
}
2024/6/9 22:25
加载中...