NOJ--1575---数学题

数论 感觉 就是比 图论好玩多了

真心应该当时 好好学数学啊~

先上题目~

    touch  me

题意 很简单 转换的过程有点复杂  但不是很难理解

好了 现在就直接上代码吧 

今晚可能还要再写几篇    烦~

 1 #include <iostream>
 2 using namespace std;
 3 int n;
 4 long long ans, cnt;
 5 
 6 void solve(int n)
 7 {
 8     for (int i = 2; i <= n; i++)
 9     {
10         cnt = 0;
11         if (n%i == 0)
12         {
13             n /= i;
14             cnt++;
15             while (n%i == 0)
16             {
17                 n /= i;
18                 cnt++;
19             }
20             ans *= (cnt * 2 + 1);
21         }
22     }
23 }
24 
25 int main()
26 {
27     int t;
28     while (~scanf("%d", &t))
29     {
30         while (t--)
31         {
32             ans = 1;
33             scanf("%d", &n);
34             solve(n);
35             printf("%I64d
", ans);
36         }
37     }
38     return 0;
39 }
View Code

这边完全不用64位的 当时 为了防溢出什么的 直接64了

today:

  我的无数的第一次是让我在未来的很多天乃至永远后悔的一件事

just follow your heart
原文地址:https://www.cnblogs.com/radical/p/3836645.html