若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。


  • 运维

  • 前端

  • 编程

  • 随笔

  • hust-oj

1587: 2/3/4)-D Sqr/Rects/Cubes/Boxes ?

发表于 2017-10-06   |   分类于 HUSTOJ   |   阅读次数 1,121

题目描述

How many squares and rectangles are hidden in the 4 x 4 grid below? Maybe you can count it by hand for such a small grid, but what about for a 100 x 100 grid or even larger?

What about higher dimensions? Can you count how many cubes or boxes of different size there are in a 10 x 10 x 10 cube, or how many hypercubes and hyperboxes there are in a four-dimensional 5 x 5 x 5 x 5 hypercube?.

Your program needs to be efficient, so be clever. You should assume that squares are not rectangles, cubes are not boxes, and hypercubes are not hyperboxes.

A 4 x 4 Grid A 4 x 4 x 4 Cube

输入

The input contains one integer N ( 0<=N<=100) in each line, which is the length of one side of the grid, cube, or hypercube. In the example above N = 4. There may be as many as 100 lines of input.

输出

For each line of input, output six integers S2, R2, S3, R3, S4, R4 on a single line, where S2 denotes the number of squares and R2 the number of rectangles occurring in a two-dimensional ( N x N) grid. The integers S3, R3, S4, R4 denote similar quantities in higher dimensions.

样例输入

1
2
3

样例输出

1 0 1 0 1 0
5 4 9 18 17 64
14 22 36 180 98 1198





参考代码

暂无

解析

暂无

hustoj

发表评论 取消回复

邮箱地址不会被公开。 必填项已用*标注

*
*


hoxis wechat
著作权归作者所有
站点更新说明
  • 文章目录
  • 站点概览
若是凉夜已成梦

若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。

1904 日志
6 分类
12 标签
RSS
weibo github twitter facebook

友情链接

Skip Dreams孤独患者 原站点
© 2017 若是凉夜已成梦
Powered by WordPress | 已运行
Theme By NexT.Mist