- 博客(16)
- 资源 (1)
- 收藏
- 关注
原创 HDU 1370 Biorhythms
题目链接暴力枚举即可#include#include#include#include#includeusing namespace std;int main(){ int t; scanf("%d",&t); while(t--){ int a,b,c,d,Cas=0; while(~scanf("%d%
2016-07-14 20:59:19 438
原创 codeforces #630 I. Parking Lot
题目链接4种不同的汽车,有2n-2个停车位,要求恰有n辆相同的车排在一起,问有多少种停车方案 分类讨论:1)n辆车在停车场两端,方案数为2*4*3*4^(n-3),2)n辆车不在两端,方案为4*(n-3)3*3*4^(n-4),所以总的停车方案有 24*4^(n-3)+36(n-3)*4^(n-4) #include
2016-07-13 20:09:57 416
原创 codeforces 630H. Benches
题目链接一座城市有n条南北走向的街道和n条东西走向的街道,现要将5条不用的长凳放置在街道相交处,且同一条街道上的长凳数不超过一条,问有多少种放置方案 #include#include#include#include#includeusing namespace std;typedef long long LL;LL C(LL n,LL r){ LL i
2016-07-13 18:54:53 451
原创 codefoces #630 G. Challenge Pennants
题目链接#include#include#include#include#includeusing namespace std;typedef long long LL;LL C(LL n,LL r){ LL i,j,s=1; if(r>n)return 0; if(n-r<r)r=n-r; for(i=0,j=1;i<r;i++){
2016-07-13 15:28:55 445
原创 codeforces #630 F. Selection of Personnel
题目链接排列组合 计算 C(N,5)+C(N,6)+C(N,7)#include#include#include#include#includeusing namespace std;typedef long long LL;LL C(LL n,LL r){ LL i,j,s=1; if(n-r<r)r=n-r; for(i=0,j=1;i<r
2016-07-13 13:16:33 531
原创 codeforces #630 E. A rectangle 【数学】
题目链接推公式就好了,注意爆int#include#include#include#include#includeusing namespace std;int main(){ long long x0,y0,x,y; cin>>x0>>y0>>x>>y; cout<<((x-x0)/2+1)*((y-y0)/2+1)+(x-x0)*(
2016-07-13 12:56:58 584
原创 codeforce #630 D. Hexagons!
题目链接#include#include#include#include#include#includeusing namespace std;int main(){ long long n; cin>>n; cout<<1+3*n*(n+1)<<endl;}
2016-07-13 01:34:18 415
原创 POJ 3468 线段树 区间增减 区间求和
题目链接#include#include#include#include#includeusing namespace std;#define lson l,mid,rt<<1#define rson mid+1,r,rt<<1|1const int maxn = 150000;struct Node{ long long sum,add;}st[maxn<
2016-07-12 21:49:58 502
原创 线段树 单点增减,单点替换,区间最值,区间求和(模板)
#include#include#include#include#include#includeusing namespace std;#define INF 10000000#define lson l,mid,rt<<1 //左儿子#define rson mid+1,r,rt<<1|1 //右儿子const int maxn = 222222;struct
2016-07-12 20:11:19 603
原创 POJ 3264 Balanced Lineup 线段树基础
题目链接N个数,Q次询问,每次询问区间中的最大值和最小值的差。#include#include#include#include#include#include#includeusing namespace std;#define Maxn 200005#define INF 10000000struct Node{ int l,r; //区间的左右
2016-07-11 21:13:05 360
原创 盒子放球问题
k个相同的盒子放进n个不同的盒子,求有多少种放法。输入:3 41 4输出:151首先介绍插板法:(字数比较多,直接从网上一篇文章上截图)也就是说,把k个相同的球放进n个不同的盒子,公式为C(k-1,n-1)。这道题的公式可以从插板法推导出来。对比题目发现插板法和这道题的区别在于并不是每个盒子都至少有一个球的。那么我们可以假设,每个盒子内已经有
2016-07-11 17:24:34 2100
原创 POJ 2352 Star 树状数组
题目链接在坐标上有n个星星,如果某个星星坐标为(x, y), 它的左下位置为:(x0,y0),x0按照y递增,如果y相同则x递增的顺序给出n个星星,求出所有level水平的数量。题目中输入是按照y递增,如果y相同则x递增的顺序给出的, 所以,对于第i颗星星,它的level就是之前出现过的星星中,横坐标x小于等于i星横坐标的那些星星的总数量(前面的y一定比
2016-07-11 15:46:16 431
原创 HDU 1166 一维树状数组
题目链接单点修改,区间查询和。#include#include#include#include#include#include#includeusing namespace std;int v[50005],n;int Lowbit(int x){ return x&(-x);}void Add(int pos,int val){ while(pos<
2016-07-11 14:55:50 376
原创 POJ 2367 Genealogical tree【拓普排序】
题目链接前向星写法#include#include#include#include#include#include#includeusing namespace std;#define V 1000struct node { int v; int next;};node edge[V*4];int head[V],deg[V];int cnt;
2016-07-11 14:20:57 562
原创 HDU1285 确定比赛名次【拓普排序】
题目链接前向星拓普排序。#include#include#include#include#include#include#includeusing namespace std;#define V 1000//前向星结构体struct node { int v; //记录队伍编号 int next;};node edge[V*4];int h
2016-07-11 14:07:44 479
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人