mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 14:56:27 +00:00
4003. 完全平方数
https://www.acwing.com/problem/content/submission/code_detail/8527461/
This commit is contained in:
parent
3b4f5df33e
commit
3f5166c479
24
AcWing/4003/4003.cpp
Normal file
24
AcWing/4003/4003.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int n, a[1005], f[1000005];
|
||||
|
||||
int main() {
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
sort(a + 1, a + 1 + n);
|
||||
for (int i = n; i > 0; i--) {
|
||||
bool flag = false;
|
||||
for (int j = -1000; j <= 1000; j++) {
|
||||
flag = flag || a[i] == 1ll * j * j;
|
||||
}
|
||||
if (!flag) {
|
||||
cout << a[i] << endl;
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user