编程介的小学生 2017-08-19 11:41 采纳率: 20.5%
浏览 688
已采纳

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

  • devmiao 2017-08-29 16:40
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记