fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #include <ext/pb_ds/assoc_container.hpp>
  5. #include <ext/pb_ds/tree_policy.hpp>
  6. using namespace __gnu_pbds;
  7.  
  8. typedef tree<int,null_type, less_equal<int>,rb_tree_tag, tree_order_statistics_node_update>ordered_set;
  9.  
  10. typedef long long int ll;
  11. typedef unsigned long long int ull;
  12. #define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  13.  
  14. typedef pair<int,int>pr;
  15. #define mp make_pair
  16. #define all(i) i.begin() , i.end()
  17. #define ft first
  18. #define sn second
  19. #define pb push_back
  20. #define eps 1e-9
  21. #define SP cout<<fixed<<setprecision(10);
  22.  
  23. /// BISMILLHIR RAHMANIR RAHIM
  24. ///------------------------------------------------------------
  25. #define YES cout<<"YES\n";
  26. #define NO cout<<"NO\n";
  27. #define dbg cout<<"rony\n";
  28. #define setbit(n,k) n&(1 << (k-1))
  29.  
  30. #define inf 100000
  31. #define MAXN 10000005
  32.  
  33. const int mod = 998244353;
  34. vector<ll>v;
  35. bool prime[MAXN];
  36. void sieve()
  37. {
  38. v.pb(2);
  39. for(ll i=3;i*i<MAXN;i+=2)
  40. {
  41. if(prime[i] == false){
  42. for(ll j=i*i;j<MAXN;j+= 2*i)
  43. prime[j] = true;
  44. }
  45. }
  46. for(int i=3;i<MAXN;i+= 2) if(prime[i] == false) v.pb(i);
  47. }
  48. void solve()
  49. {
  50. ll n;
  51. cin >> n;
  52. ll an =1;
  53.  
  54. for(ll i = 0;i < v.size() && v[i]*v[i] <= n;i++)
  55. {
  56. if(n%v[i] == 0)
  57. {
  58. ll a = 0;
  59. while(n%v[i] == 0)
  60. {
  61. n /= v[i];
  62. a++;
  63. }
  64.  
  65. // cout<<i<<" "<<a<<endl;
  66. an *= (( 2LL*a) + 1LL);
  67. }
  68. }
  69.  
  70. if(n != 1)
  71. {
  72. an *= 3LL;
  73. }
  74. cout<<(an + 1LL)/2LL<<endl;
  75. //cout<<an<<endl;
  76. }
  77. int main()
  78. {
  79. IOS;
  80. ll t;
  81. //t = 1;
  82. cin >> t;
  83.  
  84. sieve();
  85.  
  86. int c = 0;
  87. while ( t-- )
  88. {
  89. cout<<"Case "<<++c<<": ";
  90. solve();
  91. }
  92. return 0;
  93. }
  94. /// A L H A M D U L I L L A H
  95.  
Success #stdin #stdout 0.05s 22312KB
stdin
Standard input is empty
stdout
Standard output is empty