Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
`Code:`
#include<bits/stdc++.h>
using namespace std;
#define fastread() (ios_base:: sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL))
#define ll long long int
ll t, n;
void solve(){
cin >> n;
ll cnt = 0;
for (int i = 1; i <= sqrt(n); i++){
if (n % i == 0){
cnt++;
if (n / i != i){
cnt++;
}
}
}
if (cnt % 2 == 0) cout << "CHAN\n";
else cout << "LE\n";
}
int main(){
fastread();
cin >> t;
while (t--)
solve();
return 0;
}
$\text{#KL0112}$
Hãy giúp mọi người biết câu trả lời này thế nào?
- những số chính phương luôn có số ước là lẻ => kiểm tra số chính phương
code:
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
long long n;
cin >> n;
if (sqrt(n)==round(sqrt(n))) cout << "LE";
else cout << "CHAN";
}
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin