题解 | #约数的个数#
约数的个数
https://www.nowcoder.com/practice/04c8a5ea209d41798d23b59f053fa4d6
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<set> #include<queue> #include<stack> #include<map> using namespace std; int solve(int n){ int m = 0; for(int i = 1;i*i<=n;i++){ if(n%i==0) { m++; if(i!=n/i) m++; } } return m; } int main() { int t; cin >> t; while(t--){ int n; cin >> n; cout << solve(n)<<endl; } return 0; }