上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 21 下一页
摘要: 用O(n),算法优化 阅读全文
posted @ 2018-05-25 19:32 lmjer 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8101 Accepted: 4963 Description A lattice point (x, y) in the first 阅读全文
posted @ 2018-05-25 18:51 lmjer 阅读(153) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; typedef long long ll; const ll maxn=20000+10; ll ma,mb,mc,md,mx,a,b,c,d,x; ll prime[maxn],cnt[maxn]; ll top; bool p[4000000+10]; ll getnum(ll gc,ll ... 阅读全文
posted @ 2018-05-24 18:37 lmjer 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 4790: Lydsy1053 反素数 Description 对于任何正整数 x,其约数的个数记作g(x)。例如g(1)=1,g(6)=4。 如果某个正整数 x 满足:对于任意的 0<i<x,都有 g(x)>g(i),那么称 x 为反质数。例如整数 1,2,4,6 等都是反质数。 现在给定一个数 阅读全文
posted @ 2018-05-22 19:12 lmjer 阅读(171) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; const int maxn=3000000+10; int a[maxn]; priority_queue,greater >q1; priority_queueq2; int main(){ int n,k; int v; sca... 阅读全文
posted @ 2018-05-21 19:09 lmjer 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 我们知道,上一种算法有一个地方是重复比较了,就是在找当前的f(i)的时候,i的前面k-1个数其它在算f(i-1)的时候我们就比较过了。那么我们能不能保存上一次的结果呢?当然主要是i的前k-1个数中的最大值了。答案是可以,这就要用到单调递减队列。 单调递减队列是这么一个队列,它的头元素一直是队列当中的 阅读全文
posted @ 2018-05-17 19:24 lmjer 阅读(200) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; const int maxn=100000+10; int trie[maxn][20]; char c[maxn][20]; int tot; bool endi[maxn*20]; void myinsert(char* st){ int len=strlen(st); i... 阅读全文
posted @ 2018-05-15 19:28 lmjer 阅读(253) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; const int maxn=1000+10; bool tu[maxn][maxn]; int h[maxn][maxn],l[maxn],r[maxn]; int main(){ int n,k,m; char c[10]; scanf("%d",&k); w... 阅读全文
posted @ 2018-05-15 18:26 lmjer 阅读(219) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; int d[6000000][2],cnt; struct edge { int to,w,next; edge(int x,int y,int z):to(x),w(y),next(z){} edge(){} }e[400005]; int num[1000... 阅读全文
posted @ 2018-05-13 09:07 lmjer 阅读(309) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; const int maxn=1000000; long long v[maxn],prime[maxn]; bool ans[1000000+10]; long long ans2[1000000+10]; int main(){ int l,r; ... 阅读全文
posted @ 2018-05-08 19:40 lmjer 阅读(103) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 21 下一页