编程介的小学生 2017-08-21 01:16 采纳率: 20.5%
浏览 718
已采纳

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条回答 默认 最新

  • threenewbee 2017-09-02 15:45
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 fluent无法启动
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架
  • ¥15 有关sql server business intellige安装,包括SSDT、SSMS。