From 3f5166c479a82b3351b9af310e72e86310c3e3aa Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sat, 30 Oct 2021 19:25:07 +0800 Subject: [PATCH] =?UTF-8?q?4003.=20=E5=AE=8C=E5=85=A8=E5=B9=B3=E6=96=B9?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/8527461/ --- AcWing/4003/4003.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 AcWing/4003/4003.cpp diff --git a/AcWing/4003/4003.cpp b/AcWing/4003/4003.cpp new file mode 100644 index 00000000..a25ddec8 --- /dev/null +++ b/AcWing/4003/4003.cpp @@ -0,0 +1,24 @@ +#include + +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; +}