1 solutions
-
0
快速求因子数
#include <iostream> #include <cmath> #include <algorithm> #include <cstring> #define int long long #define endl '\n' #define QAQ ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; const int N=1e5+5; int f(int n) { int x=0,ans=1; for(int i=2;i*i<=n;i++) { x=0; while(n%i==0) { x++; n/=i; } ans*=(x+1); } return n>1?ans*2:ans; } void solve() { int n; cin>>n; cout<<f(n)<<endl; } signed main() { QAQ; int t=1; cin>>t; while(t--) solve(); return 0; }
Information
- ID
- 6976
- Time
- 5000ms
- Memory
- 256MiB
- Difficulty
- 9
- Tags
- (None)
- # Submissions
- 205
- Accepted
- 9
- Uploaded By