05 2018 档案
摘要:4794: The Luckiest Number Description Chinese people think of '8' as the lucky digit. Bob also likes digit '8'. Moreover, Bob has his own lucky number
阅读全文
摘要:Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8101 Accepted: 4963 Description A lattice point (x, y) in the first
阅读全文
摘要:#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 ...
阅读全文
摘要: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 等都是反质数。 现在给定一个数
阅读全文
摘要:#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...
阅读全文
摘要:我们知道,上一种算法有一个地方是重复比较了,就是在找当前的f(i)的时候,i的前面k-1个数其它在算f(i-1)的时候我们就比较过了。那么我们能不能保存上一次的结果呢?当然主要是i的前k-1个数中的最大值了。答案是可以,这就要用到单调递减队列。 单调递减队列是这么一个队列,它的头元素一直是队列当中的
阅读全文
摘要:#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...
阅读全文
摘要:#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...
阅读全文
摘要:#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...
阅读全文
摘要:#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; ...
阅读全文
摘要:4753: Lydsy2351 Matrix Description 给定一个M行N列的01矩阵,以及Q个A行B列的01矩阵,你需要求出这Q个矩阵哪些在原矩阵中出现过。 所谓01矩阵,就是矩阵中所有元素不是0就是1。 Input 输入文件的第一行为M、N、A、B,参见题目描述。 接下来M行,每行N个
阅读全文
摘要:#include #include using namespace std; const int maxn=100000+10; const int p=99991; int a[7]; bool check[maxn]; int next[maxn],adj[maxn]; int snow[maxn][10]; int tot; int H(int x[]){ int h1=0,...
阅读全文
摘要:#include #include #include using namespace std; const int maxn=1000000; int q[maxn],a[maxn]; int main(){ int n; int m; scanf("%d%d",&n,&m); for (int i=1;i=a[i]) r--;//保证队列的单调性,即保证队...
阅读全文
摘要:问题试求至少用几个双端队列可排序 那么我们不妨换过来思考,将数列排好序后,再来找队列个数
阅读全文

浙公网安备 33010602011771号