1666. Diophantus of Alexandria

单点时限: 2.0 sec

内存限制: 256 MB

Diophantus of Alexandria was an Egypt mathematician living in Alexandria. He was one of the first mathematicians to study equations where variables were restricted to integral values. In honor of him, these equations are commonly called Diophantine equations. One of the most famous Diophantine equation is xn + yn = zn. Fermat suggested that for n > 2, there are no solutions with positive integral values for x, y and z. A proof of this theorem (called Fermat’s last theorem) was found only recently by Andrew Wiles.

Consider the following Diophantine equation:

Clearly, enumerating these solutions can become tedious for bigger values of n. Can you help Diophantus compute the number of distinct solutions for big values of n quickly?

输入格式

The first line contains the number of scenarios. Each scenario consists of one line containing a single number n (1 ≤ n ≤ 10^9).

输出格式

The output for every scenario begins with a line containing “Scenario #i:”, where i is the number of the scenario starting at 1. Next, print a single line with the number of distinct solutions of equation (1) for the given value of n. Terminate each scenario with a blank line.

样例

Input
2
4
1260
Output
Scenario #1:
3
Scenario #2:
113

14 人解决,29 人已尝试。

18 份提交通过,共有 66 份提交。

6.3 EMB 奖励。

创建: 17 年,3 月前.

修改: 7 年,3 月前.

最后提交: 1 年,5 月前.

来源: TUD Programming Contest 2006, Darmstadt, Germany

题目标签