摘要: 练习: 1.模拟 洛谷: P1007 独木桥 https://www.luogu.org/problem/show?pid=1007 http://www.cnblogs.com/gc812/p/6035097.html 第一次第二次成交 https://www.luogu.org/problem/ 阅读全文
posted @ 2016-11-06 11:07 pandaB 阅读(307) 评论(0) 推荐(0) 编辑
摘要: //摘自洛谷: //0x3f3f3f3f还能给我们带来一个意想不到的额外好处:如果我们想要将某个数组清零,我们通常会使用memset(a,0,sizeof(a))这样的代码来实现(方便而高效) //但是当我们想将某个数组全部赋值为无穷大时(例如解决图论问题时邻接矩阵的初始化),就不能使用memset 阅读全文
posted @ 2016-10-30 10:47 pandaB 阅读(499) 评论(1) 推荐(0) 编辑
摘要: 1 int find(int x) 2 { 3 if(father[x]!=x)father[x]=find(father[x]); 4 return father[x]; 5 } 6 void u(int r1,int r2) 7 { 8 father[r2]=r1; 9 } 高精度系列 1 vo 阅读全文
posted @ 2016-08-17 14:09 pandaB 阅读(400) 评论(4) 推荐(0) 编辑
摘要: https://www.luogu.org/problemnew/show/P1047 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace 阅读全文
posted @ 2018-10-15 21:12 pandaB 阅读(301) 评论(0) 推荐(0) 编辑
摘要: double a= pow(double x, double y);//返回x的y次方。 double a= sqrt(double x);//返回x的平方根。 double a=ceil(double x);//返回大于或等于x的最小整数值。 double a=fabs(double x);//返 阅读全文
posted @ 2018-07-12 13:16 pandaB 阅读(1807) 评论(0) 推荐(0) 编辑
摘要: 第一个任务 //a+b就不打了 新手试水题233 P1421 小玉买文具 简单模拟问题 把a元b角全部转化为角后就可以容易地解决了 #include<iostream> #include<cstdio> using namespace std; int main() { int a,b,n; cin 阅读全文
posted @ 2018-07-12 10:46 pandaB 阅读(1085) 评论(0) 推荐(0) 编辑
摘要: EOJ 3507 坑爹的售票机 问题描述 oxx 和 xjj 决定和小伙伴们一同坐船前往 Xiamen。去 Xiamen 的船票一张 p 元。 当他们满怀兴致地来到港口时发现居然只有不设找零的自动售票机,只能使用一元,五元,十元,二十元,五十元,一百元的纸币,且一次至多买 k 张船票。因此他们不得不 阅读全文
posted @ 2018-07-09 09:47 pandaB 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 字符串读入直接读字符数组 char s[1004];scanf("%s",s); 但是要用strlen(s)来算长度 复杂度O(n) e.g.a串是不是b的子串 //从a第0位开始枚举 //如果a的第0位=b的第i位 //就从b的第i位开始枚举检查 #include<cstdio> #include 阅读全文
posted @ 2017-11-10 19:08 pandaB 阅读(288) 评论(0) 推荐(0) 编辑
摘要: pair<int,int>是一个类型 pair<int,int>A 表示定义一个pair<int,int>A 这时候就可以在A这个位置存两个数啦访问它们的时候就A.first/A.second // queue<pair<int,int> queue<pair<int,int> 优先队列 prior 阅读全文
posted @ 2017-11-09 20:15 pandaB 阅读(257) 评论(0) 推荐(0) 编辑
摘要: for(int i=1;i<=scc;i++) if(!ru[i]) q.push(i); while(!q.empty()){ int x=q.front();q.pop(); for(int i=hd[x];i;i=ed[i].next){ hav[ed[i].to] += hav[x]; -- 阅读全文
posted @ 2017-11-05 09:35 pandaB 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 1684: 金币 题目描述 国王将金币作为工资,发放给忠诚的骑士。第一天,骑士收到一枚金币;之后两天(第二天和第三天) ,每天收到两枚金币;之后三天(第四、五、六天) ,每天收到三枚金币;之后四天(第七、八、九、十天) ,每天收到四枚金币……;这种工资发放模式会一直这样延续下去:当连续 N 天每天收 阅读全文
posted @ 2017-06-27 22:15 pandaB 阅读(655) 评论(0) 推荐(0) 编辑
摘要: 1617: 阿克曼函数(递归) 题目描述 阿克曼( Ackmann) 函数 A(x, y) 中, x, y 定义域是非负整数, 函数值定义为: 阿克曼( Ackmann) 函数 A(x, y) 中, x, y 定义域是非负整数, 函数值定义为: 输入 输入两个数,表示m和n。 两个数均不超过10。 阅读全文
posted @ 2017-06-27 21:53 pandaB 阅读(332) 评论(0) 推荐(0) 编辑
摘要: n的全排列 题目描述 输入一个整数n,输出的n的全排列。 输入一个整数n,输出的n的全排列。 输入 输出 样例输入 样例输出 #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> using namespa 阅读全文
posted @ 2017-06-23 13:50 pandaB 阅读(500) 评论(0) 推荐(0) 编辑