

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
Câu 3
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("UOC.INP","r",stdin);
freopen("UOC.OUT","w",stdout);
long n,count = 0;
cin >> n;
for (long i = 1; i <= sqrt(n); i++)
if (n % i == 0)
if (n / i == i) count++;
else count += 2;
cout << count;
return 0;
}
Câu 4
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
freopen("DEMCAP.INP","r",stdin);
freopen("DEMCAP.OUT","w",stdout);
long n,a,odd = 0,even = 0,res = 0;
cin >> n;
for (long i = 0; i < n; i++) {
cin >> a;
if (a % 2 == 0) {
res += even;
even++;
} else {
res += odd;
odd++;
}
}
cout << res;
return 0;
}
Hãy giúp mọi người biết câu trả lời này thế nào?

`\bb\text{Câu 3:}`
#include <iostream>
#define ll long long
using namespace std;
int main() {
//freopen("UOC.INP", "r", stdin);
//freopen("UOC.OUT", "w", stdout);
ll n, res=0 ; cin >> n;
for (int i=1; i*i<=n; ++i)
if (n % i == 0) {
++ res;
if (i * i != n) ++ res;
}
cout << res;
}
$\\$
$\\$
`\bb\text{Câu 4:}`
#include <iostream>
#define ll long long
using namespace std;
int main() {
//freopen("DEMCAP.INP", "r", stdin);
//freopen("DEMCAP.OUT", "w", stdout);
ll n, c=0, l=0, res=0 ; cin >> n;
for (ll i=1; i<=n; ++i) {
int tmp ; cin >> tmp;
if (tmp % 2 == 0) {
res = res + c;
++ c;
}
else {
res = res + l;
++ l;
}
}
cout << res;
}
$\\$
$\\$
`\bb\color{green}{\text{@Daoanhviet96}}`
Hãy giúp mọi người biết câu trả lời này thế nào?

Bảng tin