题解 | #约数的个数#
约数的个数
https://www.nowcoder.com/practice/04c8a5ea209d41798d23b59f053fa4d6
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
while (cin >> n) {
for(int i=1;i<=n;i++)
{
int x;cin>>x;
int bound=sqrt(x);
int count=0;
for(int j=1;j<=bound;j++)
{
if(x%j==0)
{
if(j==x/j)count++;
else
count+=2;
}
}
if(count!=0)cout<<count<<endl;
}
}
}

深信服公司福利 736人发布