自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(55)
  • 收藏
  • 关注

原创 1006 Sign In and Sign Out (25 分)

#include <iostream> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <string> using namespace std; const int inf = 0x3fffffff; ...

2019-02-13 21:47:49 115

原创 1005 Spell It Right (20 分)

#include <iostream> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <string> using namespace std; const int inf = 0x3fffffff; ...

2019-02-13 21:30:13 165

原创 1004 Counting Leaves (30 分)

思路:并查集,建立家谱树,用数组root[]存储, used[]记录非叶节点,然后dfs查找每个节点的rank[], 查找过程可剪枝, 最后排序输出。 #include <iostream> #include <algorithm> #include <cstdio> #include <vector> #include <cstring&...

2019-02-13 20:52:37 156

原创 1003 Emergency (25 分)

#include <iostream> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <string> using namespace std; const int inf = 0x3fffffff; ...

2019-02-13 16:02:04 96

原创 1060 爱丁顿数 (25 分)

#include<iostream> #include<cstdio> #include<cstring> #include<cctype> #include<cmath> #include<algorithm> #include<map> using namespace std; int cmp(int a,

2019-02-09 23:17:08 208

原创 1059 C语言竞赛 (20 分)

#include<iostream> #include<cstdio> #include<cstring> #include<cctype> #include<cmath> #include<algorithm> #include<map> using namespace std; int isPrime(in

2019-02-09 23:02:59 284

原创 1058 选择题 (20 分)

#include<iostream> #include<cstdio> #include<cstring> #include<cctype> #include<cmath> #include<algorithm> #include<map> using namespace std; int main(){

2019-02-09 21:53:24 248

原创 1055 集体照 (25 分)

 若name用char型,记得用 getchar()吸收换行符,用char卡了三小时,改成string立马过了= = #include<iostream> #include<cstdio> #include<cstring> #include<cctype> #include<cmath> #include<algorithm&...

2019-02-09 19:03:24 198

原创 PTA_B_1054 求平均值 (20 分)

#include<iostream> #include<cstdio> #include<cstring> #include<cctype> #include<cmath> #include<algorithm> #include<map> using namespace std; double num = 0

2019-02-09 15:15:23 341

原创 图论小结

BellmanFord\dijkstra\堆优化\FloydWarshall\prime\kruskal算法的简单实现//图的表示 const int maxv = 1e5; //struct Edge{ int to, cost; }; //vector<Edge> G[maxv]; vector<int> G[maxv]; int main() { int v, e; scanf

2017-07-26 00:21:06 232

原创 并查集简单实现

const int maxn = 50010; int root[maxn];//父亲 int rank[maxn];//数的高度 int n;//初始化n个元素 void init(){ for(int i = 0; i < n; i++){ root[i] = i; rank[i] = 0; } }//查询树的根 int find(int x){

2017-07-22 23:31:22 153

原创 binarySearchTree 简单链表实现

//binarySearchTree struct node{ int val; node *lson, *rson; }node* insert(node *p, int x){ if(p == null){ node *q = new node; q->val = x; q->lson = q->rson = null;

2017-07-22 19:08:32 207

原创 HDU1026 Ignatius and the Princess I(BFS)

Problem Description The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166’s castle. The castle is a large labyrinth.

2017-07-22 13:32:10 239

原创 HDU3152 Obstacle Course(BFS)

Problem Description You are working on the team assisting with programming for the Mars rover. To conserve energy, the rover needs to find optimal paths across the rugged terrain to get from its start

2017-07-21 23:48:53 227

原创 HDU1678 Shopaholic

ShopaholicProblem Description Lindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only pay for two, she goes completely mad and feels a need to buy all

2017-07-21 23:18:08 195

原创 HDU4006 The kth great number(优先队列)

Problem Description Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number w

2017-07-21 23:00:59 209

原创 HDU1180 诡异的楼梯(BFS)

Problem Description Hogwarts正式开学以后,Harry发现在Hogwarts里,某些楼梯并不是静止不动的,相反,他们每隔一分钟就变动一次方向. 比如下面的例子里,一开始楼梯在竖直方向,一分钟以后它移动到了水平方向,再过一分钟它又回到了竖直方向.Harry发现对他来说很难找到能使得他最快到达目的地的路线,这时Ron(Harry最好的朋友)告诉Harry正好有一个魔法道

2017-07-21 18:27:33 183

原创 HDU1434 幸福列车(优先队列)

Problem Description 一批幸福的列车即将从杭州驶向幸福的终点站——温州,身为总列车长的linle有一些奇怪的癖好。他会记录下全部乘客的名字(name)和他们的人品值(RP),根据这些将他们排序,并不时地从某辆列车里踢出人品最不好(RP值最低)的一个人,当两个人人品一样不好时,他就会踢出名字难听的人(linle认为按字典顺序,排在越在后面的人名字越难听)。当然出于列车行驶需要,他还

2017-07-21 14:07:40 202

原创 HDU1873 看病要排队(优先队列)

看病要排队看病要排队这个是地球人都知道的常识。 不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别为1的优先权最低。医生在看病时,则会在他的队伍里面选择一个优先权最高的人进行诊治。如果遇到两个优先权一样的病

2017-07-21 13:24:22 234

原创 HDU 1689 Just a HooK(线段树+延迟标记)

Just a Hook Time Limit : 4000/2000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 0 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font Size

2017-07-19 18:40:06 217

原创 HDU 1556 color the ball

Color the ball Time Limit : 9000/3000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 0 Accepted Submission(s) : 0 Font: Times New Roman | Verdana | Georgia Font S

2017-07-19 10:55:19 141

原创 HDU 1166 敌兵布阵

线段树基础题,数组要开大Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些

2017-07-19 10:35:26 136

原创 DFS小练习

#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<iterator> #include<map> using namespace std; typedef unsigned long lo

2017-07-18 09:45:50 182

原创 HK Maximum Subarray Sum

#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<iterator> #include<map> using namespace std; typedef unsigned long lo

2017-07-17 15:03:50 174

原创 HK Gridland Metro

#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<iterator> #include<map> using namespace std; typedef long long ll; ty

2017-07-17 10:37:27 243

原创 HK Missing Numbers

#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<iterator> #include<map> using namespace std;int main() { int n;

2017-07-16 10:11:19 210

原创 hackerrank The Time in Words

#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<iterator> #include<map> using namespace std;int main() { string t

2017-07-14 09:57:04 226

原创 ACM 优先队列和堆

//heap int sz = 0; int heap[maxn];void push(int x){ int i = sz++; int p; while(i > 0){ p = (i - 1) / 2;//父亲节点编号 if(heap[p] <= x) break;//如果已经没有大小颠倒则退出 heap[i] = heap

2017-07-13 23:21:43 275

原创 hackerrank Organizing Containers of Balls

#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<iterator> #include<map> using namespace std;int M[110][110]; long lon

2017-07-13 19:05:25 258

原创 hackerrank Queen's Attack II

#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> #include<set> #include<iterator> #include<map> using namespace std;int main() { int n, k

2017-07-13 13:37:45 301

原创 ACM 线段树

求给定区间中的最值问题。对于长度为n的数列A,求数组A中下标在[i,j]里的最小值。 注: 这里下标从1开始 输入: 第一行两个整数n和q,分别表示数列的长度和询问的次数。 接下来n行为n个整数,表示数列A中的元素。 接下来q行中,每行有两个整数,表示所询问的区间[I, j]的两个端点 输出: 对每一个询问,给出指定区间中的最小值 样例输入: 9 2 5 8 1 3 6 4 9

2017-07-12 09:41:07 365

原创 ACM 组合数学

//C(n,r) int c(int n,int r){ int c=1; for(int i=0;i<r;i++) c=c*(n-i)/(i+1); return c; }//排列生成函数 next_permutation string str; cin >> str; sort(str.begin(), str.end()); cout <

2017-07-11 17:22:05 352

原创 ACM 数论

//数论 //辗转相除法 int gcd(int a, int b){ if(b == 0) return a; return gcd(b,a%b); }//扩展欧几里得 int extgcd(int a, int b, int &x, int &y){ if(b == 0){ x = 1; y = 0; return a; }else

2017-07-10 19:55:53 239

原创 hdu5256: 序列变换

题意:一个数列,a1,a2,a3,a4,—,an,需要最少修改多少个元素,使得这个序列严格递增?a[i]-i 非递减序列 因为a[i]#include<stdio.h> #include<iostream> #include<string.h> #include<math.h> #include<algorithm> #include<queue> using namespace std;int b

2017-05-22 19:28:34 269

原创 BFS------迷宫

走迷宫Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission(s) : 92 Accepted Submission(s) : 10 Font: Times New Roman | Verdana | Georgia Font Size: ← → P

2017-05-22 17:48:56 188

转载 wampServer多站点配置

1.配置wamp网站地址: 找到wamp的安装目录,如~\wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf 打开httpd-vhosts.conf文件 其中有默认的样例: ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "c:/Apache24/doc

2017-02-02 00:38:57 284

原创 备忘

modu2333@yahoo.com

2017-01-28 15:59:51 153

原创 最长有序上升子序列

如题,代码如下:#include<iostream>#include<algorithm>#include<stdio.h>using namespace std;const int n =10;int a[] = {1,2,3,5,4,7,9,6,10,8};int dp[n]; //dp[i]表示长度为i+1的上升子串中末尾元素的最小值int len[n];//len[i]表示以a[i]结尾的

2017-01-20 17:01:29 293

原创 hdoj 计算直线交点个数

计算直线的交点数Problem Description 平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数。 比如,如果n=2,则可能的交点数量为0(平行)或者1(不平行)。Input 输入数据包含多个测试实例,每个测试实例占一行,每行包含一个正整数n(n<=20),n表示直线的数量.Output 每个测试实例对应一行输出,从小到大列出所有相交方案,其中每个数为可能的交点数,每行

2017-01-18 14:16:11 401

原创 Sherlock and Cost

Array A contains the elements, A1,A2…AN. And array B contains the elements, B1,B2…BN. There is a relationship between Ai and Bi, ∀ 1 ≤ i ≤ N, i.e., any element Ai lies between 1 and Bi.Let the cost S

2017-01-15 19:25:19 361

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除