上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页
摘要: #### 1.GCD ```C++ ll GCD(ll a,ll b) { return b?GCD(b,a%b):a ;} ``` #### 2.快速GCD(Extend great common divisor) ```C++ ll QGCD(ll l,ll r,ll &x,ll &y) { i 阅读全文
posted @ 2019-11-04 23:46 __MEET 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 Input 测试输入包 阅读全文
posted @ 2019-11-03 19:45 __MEET 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 重载运算符的介绍 C++中预定义的运算符的操作对象只能是基本数据类型。但实际上,对于许多用户自定义类型(例如类),也需要类似的运算操作。这时就必须在C++中重新定义这些运算符,赋予已有运算符新的功能,使它能够用于特定类型执行特定的操作。运算符重载的实质是函数重载,它提供了C++的可扩展性,也是C++ 阅读全文
posted @ 2019-11-02 08:32 __MEET 阅读(8633) 评论(0) 推荐(2) 编辑
摘要: #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define mem(s,t) memset(s,t,sizeof(s)) #define pq priority... 阅读全文
posted @ 2019-11-01 23:56 __MEET 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1)递归 int GetHeight(link root) { if(NULL== root) return false; int left_count = GetHeight(root->ls)+1; int right_count = GetHeight(root->rs)+1; return left_count > right_count ... 阅读全文
posted @ 2019-10-30 20:13 __MEET 阅读(2009) 评论(0) 推荐(1) 编辑
摘要: /* 判断单链表是否存在环 1)暴力:双层循环遍历(n^2) 2)双指针:快指针fast=NULL,慢指针slow=NULL int judge(link head) { if(NULL==head) return false; link fast = head, slow = head; while(slow!=NULL && fast!=NULL) { slow = slow->next; f 阅读全文
posted @ 2019-10-30 19:47 __MEET 阅读(127) 评论(0) 推荐(0) 编辑
摘要: There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the i 阅读全文
posted @ 2019-10-28 23:27 __MEET 阅读(130) 评论(0) 推荐(0) 编辑
摘要: A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Ea 阅读全文
posted @ 2019-10-27 22:50 __MEET 阅读(183) 评论(0) 推荐(0) 编辑
摘要: A - 敌兵布阵 A - 敌兵布阵 C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清 阅读全文
posted @ 2019-10-25 23:50 __MEET 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 小Z家住在一条短胡同里,这条胡同的门牌号从1开始顺序编号。 若其余各家的门牌号之和减去小Z家门牌号的两倍,恰好等于n,求小Z家的门牌号及总共有多少家。(有多解的情况下输出总家庭数最少的方案,题目肯定有解) 小Z家住在一条短胡同里,这条胡同的门牌号从1开始顺序编号。 若其余各家的门牌号之和减去小Z家门 阅读全文
posted @ 2019-10-25 00:01 __MEET 阅读(326) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页