摘要:
RMQ 感觉线段树 也就那样儿 #include <bits/stdc++.h> using namespace std; const int maxn = 10010; int s[maxn<<2]; void up(int rt){ s[rt] = max(s[rt<<1] , s[rt<<1| 阅读全文
摘要:
#include <bits/stdc++.h> using namespace std; int n; const int maxn = 1e5+10; bool s[maxn]; void is_prime() { memset(s,true,sizeof(s)); s[0] = s[1] = 阅读全文
摘要:
1081 子段求和 给出一个长度为N的数组,进行Q次查询,查询从第i个元素开始长度为l的子段所有元素之和。 例如,1 3 7 9 -1,查询第2个元素开始长度为3的子段和,1 {3 7 9} -1。3 + 7 + 9 = 19,输出19。 Input 第1行:一个数N,N为数组的长度(2 <= N 阅读全文
摘要:
#include <bits/stdc++.h> using namespace std; int extgcd (int a,int b,int &x,int &y){ int d = a; if(b != 0){ d = extgcd(b,a%b,y,x); y -= (a / b)*x; } 阅读全文
摘要:
思路传送门 :http://blog.csdn.net/kk303/article/details/9629329 n里面挑选m个 可以递推从n-1里面挑m个 然后n-1里面的x 可以转换成 n里面的x 的公式 x = (x+m)%n; #include <bits/stdc++.h> using 阅读全文