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. intro

    懒得自己折腾wordpress又很想写博客. 作为一名把自己当成programmer的data scientist,毅然选择了博客园. 这里我想内容就是平时学到/使用的各种心得,更新频率不定. 兴趣范 ...

  3. poI地址纠偏查询存储过程理解

    1.POI存储过程查询 服务器类型:PostgreSQL function name 函数名字 address_parse_no_save(lon float8, lat float8) DECLAR ...

  4. Aix5~6小机运维

    1,0516-787 extendlv: Maximum allocation for logical volume hd3        is 512 smitt chlv改max logical ...

  5. python模块目录文件后续

    1,新增PythonModule加载path Ruiy tip(关于python list[]数据库类型特殊你懂的!append(""),extend([""] ...

  6. [IOS]UIWebView 请求网络页面或者加载本地资源页面

    UIWebView是一个能够显示网页的IOS视图控件,我们可以用它来访问一个网站.下面是具体的实例: 操作步骤: 1.首先在xib文件中拖放一个UIWebView控件到view中 2.将下载的页面以及 ...

  7. convert用法(数据库中原本储存的格式是Nvarchar,如何修改成datetime格式)

    查询这张表得到的数据如图 select CONVERT(nvarchar,substring([purchase-date],1,4)) +'-'+CONVERT(nvarchar,substring ...

  8. jquery promot

    http://www.itivy.com/jquery/archive/2011/10/15/jquery-impromptu-usage.html

  9. flex 载入GIF图片

    李石磊 学习日记 一.下载GIFPlayer包 二.源代码例如以下: <?xml version="1.0" encoding="utf-8"?> ...

  10. Linux基本配置和管理 4 ---- Linux系统启动详解

    1 系统启动的流程 BIOS -> MBR+boot code -> 执行引导程序: GRUB -> 加载内核 -> 执行init -> 运行runlevel 2 启动详 ...