- #include <bits/stdc++.h>
- using namespace std;
- #define MAXX 1000002
- bool isPrime[MAXX];
- vector<int>primes;
- void generate()
- {
- primes.pb(2);
- mem(isPrime, 1);
- for(int i=3; i<1002; i+=2)
- {
- if(isPrime[i])
- {
- for(int j=i*i; j<MAXX; j+=i+i)
- {
- isPrime[j] = false;
- }
- }
- }
- for(int i=3; i<MAXX; i+=2)
- {
- if(isPrime[i])
- {
- primes.pb(i);
- }
- }
- }
- int main()
- {
- generate();
- int kases, kaseno = 0;
- ll n;
- take(kases);
- ll cnt;
- ll gun;
- while(kases--)
- {
- take(n);
- cnt = 1;
- for(int i=0; i<SZ(primes) && primes[i]*primes[i]<=n; i++ )
- {
- gun = 1;
- while(n % primes[i] == 0)
- {
- gun++;
- n /= primes[i];
- }
- cnt = cnt*gun;
- }
- if(n != 1)
- {
- cnt *= 2;
- }
- pf("Case %d: %lld\n", ++kaseno, cnt-1);
- }
- }
Friday, 28 July 2017
Lightoj 1028 - Trailing Zeroes (I)
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
-
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
No comments:
Post a Comment