- 博客(14)
- 收藏
- 关注
原创 DAY2T3-军训站队
#include"stdio.h" #include"iostream" #include"math.h" #include"stdlib.h" using namespace std; long long a[100006],ans=9223372036854775807,tmp; int g[10]={0,1,1,2,2}; int n; int cmp(const void *a,const...
2018-08-15 16:50:24 417
原创 铺地毯NOIP(提高组2011DAY1T1)
题目描述 为了准备一个独特的颁奖典礼,组织者在会场的一片矩形区域(可看做是平面直角坐标系的第一象限)铺上一些矩形地毯。一共有 nn 张地毯,编号从 11 到 nn 。现在将这些地毯按照编号从小到大的顺序平行于坐标轴先后铺设,后铺的地毯覆盖在前面已经铺好的地毯之上。 地毯铺设完成后,组织者想知道覆盖地面某个点的最上面的那张地毯的编号。注意:在矩形地毯边界和四个顶点上的点也算被地毯覆盖。 输入输...
2018-08-13 20:23:55 380
原创 质因数分解
#include<stdio.h> #include<algorithm> #include"iostream" #include"stdlib.h" #include"math.h" using namespace std; int n,z; int a[100],b[100]; int main() { freopen("6.in","r",
2018-08-13 19:18:00 223
原创 埃氏筛法(筛出n以内的素数)
#include<stdio.h> #include<algorithm> #include"iostream" #include"stdlib.h" #include"math.h" using namespace std; int n,m; int v[100]; int main() { freopen("6.in","r",stdin);
2018-08-13 18:46:59 199
转载 RMQ模板
#include<stdio.h> #include<algorithm> using namespace std; typedef struct { int max; int min; }Line; Line dp[50005][22]; int a[50005]; i...
2018-08-13 14:54:46 95
原创 lca模板
#include<iostream> #include<cstdio> using namespace std; struct yyy{ int t, nex; }e[2*500001]; int deepth[500001],fa[500001][22],lg[500001],head[500001]; int tot; void add(int ...
2018-08-13 12:33:07 198
原创 小凯的疑惑
题目描述 小凯手中有两种面值的金币,两种面值均为正整数且彼此互素。每种金币小凯都有 无数个。在不找零的情况下,仅凭这两种金币,有些物品他是无法准确支付的。现在小 凯想知道在无法准确支付的物品中,最贵的价值是多少金币?注意:输入数据保证存在 小凯无法准确支付的商品。 输入输出格式 输入格式: 两个正整数 aa 和 bb ,它们之间用一个空格隔开,表示小凯中金币的面值。 输出格式...
2018-08-13 10:47:47 756
原创 优先队列使用
#include"queue" queue<int >a;//从大到小 queue<int,vector<int>,greater<int>> q;//从小到大
2018-08-12 19:32:44 122
原创 小根堆的插入与删除
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio> using namespace std; const int Maxn=1000005; int sta[Maxn]; int n,tot=0;//tot记录元素总数,记得及时更新 inline int ...
2018-08-12 19:17:28 1707
原创 并查集模板
题目描述 如题,现在有一个并查集,你需要完成合并和查询操作。 输入输出格式 输入格式: 第一行包含两个整数N、M,表示共有N个元素和M个操作。 接下来M行,每行包含三个整数Zi、Xi、Yi 当Zi=1时,将Xi与Yi所在的集合合并 当Zi=2时,输出Xi与Yi是否在同一集合内,是的话输出Y;否则话输出N 输出格式: 如上,对于每一个Zi=2的操作,都有一行输出,...
2018-08-12 18:56:52 238
原创 区间修改,单点查询(树状数组)
#include"stdio.h" #include"iostream" #include"stdlib.h" #include"math.h" using namespace std; #define MAXN 5000006 int tree[MAXN],a[MAXN]; int n,m,q,w,e,r; int lowbit(int x) {return x&(-x);} int S...
2018-08-11 23:25:18 340
原创 单点修改,区间求值(树状数组1)
#include"stdio.h" #include"iostream" #include"math.h" #include"stdlib.h" using namespace std; #define MAXN 5000006 int tree[MAXN],a[MAXN]; int m,n,q,w,e; int lowbit(int x) { return x&(-x); } v...
2018-08-11 22:39:21 156
原创 UOJ—47
【题目描述】: 给定一个长度为n的数列a,再给定一个长度为k的滑动窗口,从第一个数字开始依次框定k个数字,求每次框定的数字中的最大值和最小值,依次输出所有的这些值。下面有一个例子数组是 [1 3 1 3 5 6 7] , k 是3: 窗口位置 窗口中的最小值 窗口中的最大值 [1 3 -1] -3 5 3 6 7 ...
2018-08-11 18:34:34 352
原创 UOJ-48
#include"stdio.h" #include"iostream" #include"stdlib.h" using namespace std; #define MAXN 5000006 struct Node{ int id; long long h; }s[MAXN]; long long a[MAXN]; int n,top=1; long long ans=0; i...
2018-08-11 09:09:59 216
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人