HDOJ--1220--Cube
来源:互联网 发布:景甜面相分析知乎 编辑:程序博客网 时间:2024/05/21 20:25
Cube
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1738 Accepted Submission(s): 1383
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.
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
123
Sample Output
016297The results will not exceed int type.HintHint
题目大意:给你一个立方体,让你将它分割为一个一个的小立方体,然后问你这些小立方体中,公共点的个数《=2个的立方体有多少对。恩,数学推理问题。解决的方法就在于一个公式。表示并不会推导这个公式,数学规律总结这种事情一向是比较薄弱的一环。
AC代码:
#include<stdio.h>#include<string.h>#include<math.h>using namespace std;int main(){int n;while(scanf("%d",&n)!=EOF){if(n==1){printf("0\n");continue;}printf("%d\n",n*n*n*(n*n*n-1)/2-3*n*n*(n-1));}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)
- 上机报告2
- gstreamer AV sync
- CodeForces 651A:Joysticks【模拟】
- 程序员的机器学习入门笔记(二):Python常用库的介绍,及安装(Centos 6.5)
- Linux:Unable to locate package错误解决
- HDOJ--1220--Cube
- erlang趣事六erlangshell ssh登陆
- Android异步消息处理机制(一):简单使用
- Activity的启动模式
- Servlet过滤器Filter使用 .
- webservice小例子
- 文章标题
- 自考C++程序设计试题2010年1月
- BestCoder Round #74 (div.2) T3 Transform HDOJ 5637