hdoj 1220Cube
来源:互联网 发布:数据交换共享平台源码 编辑:程序博客网 时间:2024/06/03 22:08
Cube
Total Submission(s): 1771 Accepted Submission(s): 1405
Problem Description
Cowl is good at solving math problems. One day a friend asked him such a question: You are given a cube whose edge length is N, it is cut by the planes that was paralleled to its side planes into N * N * N unit cubes. Two unit cubes may have no common points or two common points or four common points. Your job is to calculate how many pairs of unit cubes that have no more than two common points.
Process to the end of file.
Input
There will be many test cases. Each test case will only give the edge length N of a cube in one line. N is a positive integer(1<=N<=30).Output
For each test case, you should output the number of pairs that was described above in one line.
Sample Input
1
2
3
Sample Output
0
16
297
Hint
The results will not exceed int type.
Author
Gao Bo
Source
杭州电子科技大学第三届程序设计大赛
翻译:
有一天,一个朋友问他这样一个问题:你是给一个立方体的边长度是氮,它被削减的飞机,是平行的,其侧面的飞机到氮的单位立方体。2个单位的多维数据集可能没有共同点或2个共同点或四个共同点。你的任务是计算出有多少双单位立方体没有超过2个共同点。
进程到文件结束。
输入
将有许多测试案例。每一个测试用例只会给一个数据线中的一个立方体的边长度。正整数(1 = 30)。
输出
对于每一个测试用例,你应该输出一行上面描述的对的数目。
代码:
#include<cstdio>#include<cstring>#define LL long longint main(){int n;while (~scanf("%d",&n)){LL s=0,shu,mian;mian=(n-2)*(n-2);shu=n*n*n;s=shu*(shu-7);s+=mian*6;s+=(n-2)*24;s+=8*3;printf("%lld\n",s/2);}return 0; }
0 0
- hdoj 1220 Cube
- HDOJ--1220--Cube
- hdoj 1220Cube
- hdoj 1220 Cube
- HDOJ 1220-Cube【数学推理】
- hdoj 1220 Cube(数学题)
- HDOJ 1220 Cube【数学推理】
- HDOJ 1220 Cube (数学)
- ACM--公式--HDOJ 1220--Cube
- HDOJ题目1220 Cube(组合数学)
- hdoj--1220--Cube(数学推导)
- HDOJ 3547 DIY Cube
- hdoj Cube 1220 (数学规律&排列组合)找正方体
- HDOJ 5292 Pocket Cube 构造
- HDOJ 4670: Cube number on a tree
- HDOJ 5053 the Sum of Cube
- HDOJ 3309 Roll The Cube (BFS)
- HDOJ-5053(the Sum of Cube)
- 关于大型网站技术演进的思考(四)--存储的瓶颈(4)
- jquery Easy UI怎么让datagrid显示+号
- hybridapp微博登陆从零到实现
- iOS相机相册调用 — UIImagePickerController
- Java多线程(1) 创建
- hdoj 1220Cube
- (转)php5.3中的连接MSSQLSERVER(非PDO方式)
- lightoj 1425 - The Monkey and the Oiled Bamboo 二分答案or乱搞
- Majority Element
- 关于大型网站技术演进的思考(五)--存储的瓶颈(5)
- Linux自动清理日志
- Android 代码混淆总结
- android6.0 adbd深入分析(一)adb驱动初始化、读取adb节点线程
- 苹果所有常用证书,appID,Provisioning Profiles配置说明及制作图文教程(精)