Cube

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1722    Accepted Submission(s): 1367

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

Hint

The results will not exceed int type.

 

题解:好菜,自己竟然没推出来。。。

总对数n^3*(n^3-1)/2;

点数为4的对数:一行有n-1对,一个面有总共n*n行,三个面面要乘以3;

总的减去4的就是<=2的了;

代码:

#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
#define mem(x,y) memset(x,y,sizeof(x))
#define SI(x) scanf("%d",&x)
#define PI(x) printf("%d",x)
#define P_ printf(" ")
const int INF=0x3f3f3f3f;
int main(){
int n;
while(~scanf("%d",&n)){
printf("%d\n",n*n*n*(n*n*n-)/-n*n*(n-)*);
}
return ;
}

Cube(规律)的更多相关文章

  1. HDU 1220 Cube(数学,找规律)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1220 Cube Time Limit: 2000/1000 MS (Java/Others)    M ...

  2. Cube 找规律

    这道题我们经过简单的推测便可得知3个之前特判,四个之后就成为了一般状况,就是我们每侧都是走整个整个的|_|之后零的走|||. 考试的时候包括平时做题,许多正确的感性比理性证明要强得多. #includ ...

  3. UVA 253 Cube painting(暴力打表)

    Cube painting Problem Description: We have a machine for painting cubes. It is supplied with three d ...

  4. Break the Chocolate(规律)

    Break the Chocolate Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Othe ...

  5. [补档]Cube

    Cube 题目 给你一个n×m的棋盘,有一个1×1×2的长方体竖直放在(1,1)上,你可以将其在棋盘上滚动,你的目标是让其竖直放在(n,m)上,问至少需要多少次操作.(放倒.竖直.翻滚) INPUT ...

  6. HDU 多校对抗第三场 L Visual Cube

    Problem L. Visual Cube Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java ...

  7. SQL SEVER (ROLLUP与CUBE,ROW_NUMBER())使用方法

    1.建立测试专用数据: if object_id('TESTDB') is not null drop table TESTDB ), B INT) insert into TESTDB union ...

  8. hdu1452 Happy 2004(规律+因子和+积性函数)

    Happy 2004 题意:s为2004^x的因子和,求s%29.     (题于文末) 知识点: 素因子分解:n = p1 ^ e1 * p2 ^ e2 *..........*pn ^ en 因子 ...

  9. Codeforces Round #384 (Div. 2) B. Chloe and the sequence(规律题)

    传送门 Description Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems ...

随机推荐

  1. 忽然有一种感觉:云存储必须从系统级定制,所以必须对Linux相当熟悉。Windows下开发软件的模式已经过时了

    看了诸多招聘帖子以后的感觉- 工作内容: .存储相关产品的设计.开发和维护. .Linux系统应用程序研发. .主流Linux内核文件系统研发. .自动化测试框架和工具的研发. 职位要求: .计算机相 ...

  2. GO学习资源站

    GO语言学习资源网站 http://golangtc.com https://gobyexample.com http://golang-examples.tumblr.com

  3. (十二)boost库之多线程高级特性

    (十二)boost库之多线程高级特性 很多时候,线程不仅仅是执行一些耗时操作,可能我们还需要得到线程的返回值,一般的处理方法就是定义一个全局状态变量,不断轮训状态,就如我目前维护的一个项目,全局变量定 ...

  4. 数据指令MOV

    MOV分成三类,第一类不需要拓展(MOV),第二类做符号拓展(MOVS),第三类做零拓展(MOVZ),拓展类型根据源操作数决定. 这三类根据操作的数据类型其后可加l,w,b. MOV操作的操作数可以是 ...

  5. poj 1734 Sightseeing trip_ 最小环记录路径

    题意:求最出小环,输出路径 #include <iostream> #include<cstdio> using namespace std; #define N 110 #d ...

  6. hdu 1078 FatMouse and Cheese_记忆搜索

    做这类型的搜索比较少,看懂题意花了半天 题意:给你个n*n的图,老鼠一次最远走k步,老鼠起初在(0,0),每次偷吃的东西必须比之前偷吃的要大. #include<iostream> #in ...

  7. 杭电 HDU 4608 I-number

    http://acm.hdu.edu.cn/showproblem.php?pid=4608 听说这个题是比赛的签到题......无语..... 问题:给你一个数x,求比它大的数y. y的要求: 1. ...

  8. JVM系列文章(三):Class文件内容解析

    作为一个程序猿,只知道怎么用是远远不够的.起码,你须要知道为什么能够这么用.即我们所谓底层的东西. 那究竟什么是底层呢?我认为这不能一概而论.以我如今的知识水平而言:对于Web开发人员,TCP/IP. ...

  9. MySQL之终端(Terminal)管理数据库、数据表、数据的基本操作(转)

    MySQL有很多的可视化管理工具,比如“mysql-workbench”和“sequel-pro-”. 现在我写MySQL的终端命令操作的文章,是想强化一下自己对于MySQL的理解,总会比使用图形化的 ...

  10. [DevExpress]图表开发工具类 ChartUtils

    /// <summary> /// 基于.NET 3.5的Chart工具类;对应的DevExpress版本:12.1.7; /// </summary> public stat ...