hdu 1220 容斥
http://acm.hdu.edu.cn/showproblem.php?pid=1220
Cube
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2260 Accepted Submission(s): 1819
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.
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).
2
3
16
297
Hint
The results will not exceed int type.
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define LL long long
LL qpow(LL a,LL b){LL r=;for(;b;b>>=,a=a*a)if(b&)r=r*a;return r;}
int main()
{
LL n;
while(cin>>n)
cout<<((n*n*n)*(n*n*n-)/-*(n-)*n*n)<<endl;
return ;
}
hdu 1220 容斥的更多相关文章
- HDU 4135 容斥
问a,b区间内与n互质个数,a,b<=1e15,n<=1e9 n才1e9考虑分解对因子的组合进行容斥,因为19个最小的不同素数乘积即已大于LL了,枚举状态复杂度不会很高.然后差分就好了. ...
- HDU 2841 容斥 或 反演
$n,m <= 1e5$ ,$i<=n$,$j<=m$,求$(i⊥j)$对数 /** @Date : 2017-09-26 23:01:05 * @FileName: HDU 284 ...
- HDU 1695 容斥
又是求gcd=k的题,稍微有点不同的是,(i,j)有偏序关系,直接分块好像会出现问题,还好数据规模很小,直接暴力求就行了. /** @Date : 2017-09-15 18:21:35 * @Fil ...
- HDU 4059 容斥初步练习
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> ...
- Co-prime HDU - 4135_容斥计数
Code: #include<cstdio> #include<cstring> #include<cmath> #include<iostream> ...
- How many integers can you find HDU - 1796_容斥计数
Code: #include<cstdio> using namespace std; typedef long long ll; const int R=13; ll a[R]; ll ...
- hdu 5792(树状数组,容斥) World is Exploding
hdu 5792 要找的无非就是一个上升的仅有两个的序列和一个下降的仅有两个的序列,按照容斥的思想,肯定就是所有的上升的乘以所有的下降的,然后再减去重复的情况. 先用树状数组求出lx[i](在第 i ...
- HDU 1695 GCD 容斥
GCD 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1695 Description Given 5 integers: a, b, c, d, k ...
- HDU 5794 A Simple Chess (容斥+DP+Lucas)
A Simple Chess 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5794 Description There is a n×m board ...
随机推荐
- Python中的魔术(双下划线'__xxx__')方法详解
介绍 在Python中,所有以“__”双下划线包起来的方法,都统称为“Magic Method”,中文称『魔术方法』,例如类的初始化方法 __init__ ,Python中所有的魔术方法均在官方文档中 ...
- Python里面如何拷贝一个对象?
import copy lst=[1,2,3,4,[1,2]] # 复制列表lst,命名lst2 lst2=copy.copy(lst) print(f'这是lst3:{lst2}') # 深拷贝 l ...
- 数据库之MySQL(一)
概述 1.什么是数据库 ? 数据的仓库,如:在ATM的示例中我们创建了一个 db 目录,称其为数据库 2.什么是 MySQL.Oracle.SQLite.Access.MS SQL Server等 ...
- 详解mysql数据库的左连接、右连接、内连接的区别
一般所说的左连接,外连接是指左外连接,右外连接.做个简单的测试你看吧. 先说左外连接和右外连接: SQL>select * from t1; ID NAME ---------- ------- ...
- jmeter 测试restful接口
jmeter 测试restful接口,JSON数据格式 1.添加线程组 2.添加HTTP信息头管理器 请求发送JSON数据格式参数,需要设置Content-Type为application/json ...
- $《第一行代码:Android》读书笔记——第5章 Broadcast
(一)广播机制简介 1.Android广播的分类: 如图所示: 2.发送广播:使用Intent:接收广播:Broadcast Receiver. (二)接收系统广播 1.动态注册监听网络变化 示例程序 ...
- gstreamer-tips-picture-in-picture-compositing
http://www.oz9aec.net/index.php/gstreamer/347-more-gstreamer-tips-picture-in-picture-compositing htt ...
- Windos Server 2008 NFS 服务安装使用
系统环境:Windos 2008 R2 x64位 安装服务:NFS 文件服务 我的电脑-->右击管理-->功能-->添加功能 选择网络文件系统服务工具 安装服务 添加角色 下一步 选 ...
- Nginx 常见报错
Nginx 常见报错 启动报错:[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) 原因:这个是nginx重启时经常遇到 ...
- python异步库
https://github.com/aio-libs 异步库