摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int a[110][110][110],x_map[110],y_map[110],z_map[110... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(79) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; int ss,n,d[10001],sum=0; int main() { int i,y; bool c=false; c... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 洛谷P1093 题目描述 某小学最近得到了一笔赞助,打算拿出其中一部分为学习成绩优秀的前5名学生发奖学金。期末,每个学生都有3门课的成绩:语文、数学、英语。先按总分从高到低排序,如果两个同学总分相同,再按语文成绩从高到低排序,如果两个同学总分和语文成绩都相同,那么规定学号小的同学 排在前面,这... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(466) 评论(0) 推荐(0) 编辑
摘要: 本章施工仍未完成 现在的时间是3.17 0:28,我困得要死 本来今天(昨天?)晚上的计划是把整个四道题的题解写出来,但是到现在还没写完T4的高效算法,简直悲伤。 尝试了用floyd写T4,终于大功告成AC后,看到别人的解题报告说fl能过只是因为测试数据范围小。 好像主要有三种解法,fl,di... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 计算(calc.cpp) 【问题描述】 小明在你的帮助下,破密了Ferrari设的密码门,正要往前走,突然又出现了一个密码门,门上有一个算式,其中只有“(”,“)”,“0-9”,“+”,“-”,“*”,“/”,“^”求出的值就是密码。小明数学学得不好,还需你帮他的忙。(“/”用整数除法) 【输入】... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 无需建树,递归即可。 为什么说是烂题呢? 1.pdf里的样例数据复制过来丢了空格,导致我调了很久都没有发现问题在哪。 2.如样例2所示,4个'-'下面却少一格。 3.空树,即只有'#'需要特殊处理。 1 #include 2 #include 3 #include 4 #includ... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 把每个字母看成一个结点,每个单词看成一条从第一个字母到最后一个字母的有向边。把这些单词首尾相接相当于寻找欧拉路径(一笔画)。 则其需满足两个条件:1.忽略边的方向后,原图联通。2.一个点的入度比出度大1,另一个点入度比出度小1,其他点入度和出度相等。 1 #include 2 #incl... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 int first[110],next[10010],to[10010],n; 6 bool b[110]; 7 stack sta; 8 void dfs(i... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 看完题目的长度以后应该就知道这题有多变态了。。。 接下来你将看到代码的长度。。。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 struct node 7 { 8 ... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Oil Deposits The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Quadtrees A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be spli... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 因为复制过来排版很乱,所以上截图。 1 #include 2 #include 3 int sum[10010]; 4 void bd(int p) 5 { 6 int x; 7 scanf("%d",&x); 8 if (x==-1) return; ... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 int k,num[101],key[101],test[101]; ... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Not so Mobile Before being an ubiquous communications gadget, a mobile was just a structure made of strings and wires suspending colourfull things. ... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(105) 评论(0) 推荐(0) 编辑
摘要: You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题目如下:Given a sequence of binary trees, you are to write a program that prints a level-order traversal of each tree. In this problem each node of a bi... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 描述 9月21日,今天是pink的生日,飘飘乎居士当然要去别人的领土大闹一番啦! 为了收集更多的能量到pink家大闹,飘飘乎居士准备从后花园中取出自己多年积攒的p个能量块。后花园一共被划分n个地区,能量块被分散在里面,现在飘飘乎居士拿出地图,发现自己站在1的地方,而他要做的就是用最短的... 阅读全文
posted @ 2016-05-02 16:42 SBSOI 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 1644 免费馅饼(巴蜀oj上的编号) 题面: SERKOI最新推出了一种叫做“免费馅饼”的游戏。 游戏在一个舞台上进行。舞台的宽度为W格,天幕的高度为H格,游戏者占一格。开始时,游戏者站在舞台的正中央,手里拿着一个托盘。 ... 阅读全文
posted @ 2016-05-02 16:41 SBSOI 阅读(327) 评论(0) 推荐(0) 编辑
摘要: #include #include #include int begin_prime(int a){ memset(prime,1,sizeof(prime)); memset(primes,0,sizeof(primes)); int num=0; for(int... 阅读全文
posted @ 2016-05-02 16:41 SBSOI 阅读(131) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include using namespace std; #define WIDE_AND_LONG 20 #define NAME_LEN 20 typedef cla... 阅读全文
posted @ 2016-05-02 16:41 SBSOI 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 1 /*Hello World*/ 2 #include 3 #include 4 #include 5 using namespace std; 6 int a,m,n; 7 int mx[5]={0,-1,0,1,0}; 8 int my[5]={0,0,1,0,-1}; 9... 阅读全文
posted @ 2016-05-02 16:41 SBSOI 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 快速幂: int pow(int a,int n){ int rs=1; while(n) { if(n&1) rs=rs*a; a=a*a; n=n>>1; } return rs;} 快速幂取余: //求a^b%n,O(logb)__int6... 阅读全文
posted @ 2016-04-14 13:21 SBSOI 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 欧拉回路:图G,若存在一条路,经过G中每条边有且仅有一次,称这条路为欧拉路,如果存在一条回路经过G每条边有且仅有一次, 称这条回路为欧拉回路。具有欧拉回路的图成为欧拉图。 判断欧拉路是否存在的方法 有向图:图连通,有一个顶点出度大入度1,有一个顶点入度大出度1,其余都是出度=入度。 ... 阅读全文
posted @ 2016-04-14 13:14 SBSOI 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 将杂乱无章的数据变得有规律。有各种各样的排序算法,看情况使用。 1. 选择排序 (1) 基本思想: 每一趟从待排序的数据元素中选出最小(或最大)的一个元素,顺序放在待排序的数列的最前,直到全部待排序的数据元素排完。 (2)排序过程: 【示例】: 初 始 关键字 [... 阅读全文
posted @ 2016-02-22 19:05 SBSOI 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 在竞赛中,遇到大数据时,往往读文件成了程序运行速度的瓶颈,需要更快的读取方式。相信几乎所有的C++学习者都在cin机器缓慢的速度上栽过跟头,于是从此以后发誓不用cin读数据。还有人说Pascal的read语句的速度是C/C++中scanf比不上的,C++选手只能干着急。难道C++真... 阅读全文
posted @ 2016-02-22 18:38 SBSOI 阅读(1960) 评论(0) 推荐(0) 编辑
摘要: 一、定义 Hash表,也称散列表。一般应用于有大量“动态”的插入(删除)和查找操作的一类问题。(如果是“静态”的,通常可以先对数据排序,查找时就可以用“二分查找”) 虽然可以用“平衡树”之类方法,但实践中,用hash表更简单实用。 普通的查找方法建立在... 阅读全文
posted @ 2016-02-19 13:38 SBSOI 阅读(2530) 评论(0) 推荐(0) 编辑
摘要: STL的代码从广义上讲分为三类:algorithm(算法)、container(容器)和iterator(迭代器),几乎所有的代码都采用了模板类和模版函数的方式.在C++标准中,STL被组织为下面的13个头文件:、、、、、、、、、、、和。一: vector: 从后面快速的插入与删... 阅读全文
posted @ 2016-02-18 19:35 SBSOI 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 1644 免费馅饼(巴蜀oj上的编号) 题面: SERKOI最新推出了一种叫做“免费馅饼”的游戏。 游戏在一个舞台上进行。舞台的宽度为W格,天幕的高度为H格,游戏者占一格。开始时,游戏者站在舞台的正中央,手里拿着一个托盘。 ... 阅读全文
posted @ 2016-02-16 00:06 SBSOI 阅读(706) 评论(0) 推荐(0) 编辑