编程介的小学生 2017-04-01 14:45 采纳率: 20.5%
浏览 841
已采纳

Bug Races

Two species of bugs, Red iNT and Green fLOAT, are living in Blue Matrix. They have a race at Code Cube every four years. Code Cube is a cuboid with integer dimensions. Bugs will run from the corner of Code Cube to the opposite corner in the race, choosing the shortest route. However, Red iNT can only run on the surfaces of the cuboid, and the shortest distance it runs is always an integer. Green fLOAT can run inside the cuboid, and the shortest distance it runs may be any real number. The race seems to be unfair, but iNT runs much more faster than fLOAT, so both have chance to win.

The scale of a Code Cube is defined as the maximum dimension of it. There are two different minimum cuboids satisfying the requirements above, 2×2×3 and 1×3×3, where the distances of Red iNT's routes are both 5 and the distances of Green fLOAT's routes are sqrt(17) and sqrt(19). Of course, the distances vary from one cuboid to another cuboid. Now the problem comes that bugs want to know the mean squared distances for all cuboids with the same scale.

Input

The input contains thousands of lines of integers n, which indicates the scale of Code Cube. n will be between 1 and 1000000, inclusive.

Output

Output the mean squared distance Red iNT runs and the one Green fLOAT runs as irreducible fraction, or "NaN" if both the numerator and the denominator are zero. See sample for more details.

Sample Input

1
2
3
4
1000
Sample Output

NaN NaN
NaN NaN
25/1 18/1
25/1 21/1
220986875/114 538411225/342

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答