Điểm:
100 (p)
Thời gian:
1.0s
Bộ nhớ:
256M
Input:
bàn phím
Output:
màn hình
Cho 1 mảng số nguyên \(a_1, a_2, a_3, ... a_n\) gồm \(n\) số. Hãy tìm số lớn nhất mà số đó không phải số chính phương.
Biết rằng luôn có số không phải số chính phương.
Input
- Dòng đâu tiên chứa số nguyên dương \(n (n \leq 1000)\)
- Dòng thứ 2, gồm \(n\) số nguyên \(a_1, a_2, ..., a_n (a_i ^ 2 \leq 10 ^ {12})\)
Output
- Số lớn nhất không phải scp.
Example
Test 1
Input
2
4 2
Output
2
Bình luận
CODE C++ ĐƠN GIẢN KO CẦN HÀM
include<bits/stdc++.h>
define endl '\n'
typedef long long ll;
using namespace std;
int main() {
ll n,i;cin>>n;
ll kq=LLONG_MIN;
}
solution
include <bits/stdc++.h>
using namespace std;
bool check(long long n){
int h =sqrt(n);
if (h*h == n) return false;
else return true;
}
long long n,a[1005];
main(){
cin >> n;
for (long long i = 0;i < n;i++){
cin >> a[i];
}
sort(a,a + n,greater<long long>());
for (int i = 0;i < n;i++){
if (check(a[i])){
cout << a[i]; return 0;
}
}
}
Vậy là AC nha ae
https://ideone.com/r9VA3x
share code :))
This comment is hidden due to too much negative feedback. Click here to view it.
This comment is hidden due to too much negative feedback. Click here to view it.
include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
}
code c++
This comment is hidden due to too much negative feedback. Click here to view it.
This comment is hidden due to too much negative feedback. Click here to view it.
This comment is hidden due to too much negative feedback. Click here to view it.
hmmm