摘要: problem给定n个不同的数ai求有多少个数,恰好等于另外两个(不同的)数之和n#includeusing namespace std;const int maxn = 11000;int a[maxn], b[maxn];int main(){ int n,... 阅读全文
posted @ 2018-07-23 22:20 gwj1139177410 阅读(213) 评论(0) 推荐(0)
摘要: problem给定一个N*M的棋盘求子正方形和长方形个数n,mO(n2m2)O(n2m2)。codes#includeusing namespace std;int main(){ int n, m; cin>>n>>m; int zheng = 0... 阅读全文
posted @ 2018-07-23 21:53 gwj1139177410 阅读(279) 评论(0) 推荐(0)
摘要: problemn个图书编号,q个需求码。(都是数字)求满足所有包含需求码后缀的图书编号的最小值。n,q#includeusing namespace std;const int pow[] = {1,10,100,1000,10000,100000,1000000,1... 阅读全文
posted @ 2018-07-23 21:37 gwj1139177410 阅读(189) 评论(0) 推荐(0)
摘要: problem有n个人,第i个人重量ai每艘船载重为w,最多可乘2个人求能装载所有人的最少的船数n #includeusing namespace std;const int maxn = 30010;int a[maxn];int main(){ int w,... 阅读全文
posted @ 2018-07-23 21:12 gwj1139177410 阅读(192) 评论(0) 推荐(0)
摘要: problem指定两个日期(8位数字描述)问这之间有多少日期表示是回文串(包含这两个日期本身)solution1枚举所有日期回文串判断//O((t-s)*360)#include#include#includeusing namespace std;int days[... 阅读全文
posted @ 2018-07-23 10:40 gwj1139177410 阅读(122) 评论(0) 推荐(0)
摘要: problem题意:有n个人,每个人接水wi有m个水龙头,每个水龙头每秒供水1求n个人接完水要多少时间注意:人按编号1~n接水(坑点,顺序确定)换人过程没有浪费n #include#includeusing namespace std;const int maxn =... 阅读全文
posted @ 2018-07-23 09:44 gwj1139177410 阅读(148) 评论(0) 推荐(0)
摘要: 基础算法学习笔记(状态空间)一、状态空间1、定义(什么是状态空间):一个实际问题的各种可能情况构成的集合。(解释:为什么需要算法来和程序来处理问题?如果一道题可以手算得到答案,换句话说就是存在通过代入某个数学式子就直接得到答案的,那么这道题就不是一道算法题,或者他的解... 阅读全文
posted @ 2018-07-23 08:38 gwj1139177410 阅读(616) 评论(0) 推荐(0)
选择