编程
DearDeer~
这个作者很懒,什么都没留下…
展开
-
由前序和中序求二叉树的深度
//求二叉树的深度 #include<iostream> using namespace std; struct tree{ int root; tree*right,*left; }; int depth(tree* t) { if(t==NULL) return 0; return 1+max(depth(t->left),depth(t->right))...原创 2019-07-24 16:56:49 · 506 阅读 · 0 评论 -
生日蛋糕(POJ 1190)
#include<bits/stdc++.h> using namespace std; int minA[21],minV[21],N,M;//minA表示i层蛋糕的侧面积,minV表示i层蛋糕的体积 int area=0,minarea=1<<30; int MaxPossibloV(int c,int maxr,int maxh) { int v=0; for(...原创 2019-08-02 21:44:31 · 191 阅读 · 0 评论 -
暑期第四次题目E Fishermen
Problem Description The ocean can be represented as the first quarter of the Cartesian plane. There are n fish in the ocean. Each fish has its own coordinates. There may be several fish at one point. ...原创 2019-07-30 20:52:27 · 381 阅读 · 0 评论 -
Radar Installation
百练1328:Radar Installation 描述 Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar i...原创 2019-07-25 20:00:50 · 91 阅读 · 0 评论 -
Stall Reservations(百练3190)
Description Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A…B (1 <= A <= B <= 1,000,000), which includes ...原创 2019-07-26 15:38:47 · 89 阅读 · 0 评论 -
DFS 城堡问题百练2815
输入 程序从标准输入设备读入数据。第一行是两个整数,分别是南北向、东西向的方块数。在接下来的输入行里,每个方块用一个数字(0≤p≤50)描述。用一个数字表示方块周围的墙,1表示西墙,2表示北墙,4表示东墙,8表示南墙。每个方块用代表其周围墙的数字之和表示。城堡的内墙被计算两次,方块(1,1)的南墙同时也是方块(2,1)的北墙。输入的数据保证城堡至少有两个房间。 输出 城堡的房间数、城堡中最大房间所...原创 2019-07-31 16:38:02 · 111 阅读 · 0 评论 -
LIS(百练2757)
#include using namespace std; int n; int f(int a[],int i,int pre) { if(i==n) return 0; if(a[i]>pre) return max(1+f(a,i+1,a[i]),f(a,i+1,pre)); else return f(a,i+1,pre); } int main(...原创 2019-07-26 17:22:27 · 87 阅读 · 0 评论