http://blog.csdn.net/c3568/article/details/8574538 Read More
红色表示已经A。打星号的表示个人认为比较经典,或是算法比较好的题目1014* Dividing 半个背包,注意中断,否则可能TLE1036 Gangsters 可以很水的DP过,还有多种优化的方法1038* Bugs Integrated, Inc.状态压缩1050 To the Max最大子矩形 枚举每个列数为n的矩阵,然后对这些矩阵分别进行DP处理1080 Human Gene Functions最长公共子序列拓展,此题不连续,注意初始化1088滑雪 记忆化DP1141* Brackets Sequence括号序列 经典区间DP1157 LITTLE SHOP OF FLOWERS 注意. Read More
b. 安装MinGW版本:MinGW-3.1.0-1.exe 1>配置环境变量(很重要): 步骤如下:打开:“我的电脑->属性->高级->环境变量->系统变量”编辑如下系统变量: 变量名 变量值 PATH D:\MinGW\bin; LIBRARY_PATH D:\MinGW\lib C_INCLUDEDE_PATH D:\MinGW\include CPLUS_INCLUDE_PATH D:\MinGW\include\c++\3.2.3;D:\MinGW\include\c++\3.2.3\mingw32;D:\MinGW\include\c++\3.2.3\ Read More
View Code #include<iostream>#include<cstdio>#include<set>#include<algorithm>#include<cmath>using namespace std;typedef long long ll;struct point{ll x,y,d;double z;}a[5],s,p;typedef set<point>::iterator setp;int n,i,j;set<point> f;setp it,it1,it2;ll cross(poi Read More
View Code #include <iostream>#include <cstring>#include <algorithm>#include <vector>using namespace std;#define PB push_back#define ALL(c) c.begin(), c.end()#define B begin()#define E end()vector <int> a, b, c, d;vector <int>::iterator it;int main(){ int i; for(i Read More
无重载View Code #include <cstdio>#include <cstring>#define maxn 103int n, k, mod;int ret[maxn][maxn], e[maxn][maxn];void mult(int a[maxn][maxn], int b[maxn][maxn]){ int i, j, k; int c[maxn][maxn] = {0}; for(i = 0; i < 2*n; i++) for(j = 0; j < 2*n; j++) { for(k = 0; k <... Read More
递归View Code #include <cstdio>#include <cstring>#define LL __int64LL a, b, x, y, mod, n;void gao(LL n, LL &x, LL &y){ if(n == 1) { x = a % mod, y = b % mod; return; } LL tx, ty; gao(n>>1, tx, ty); x = (tx * tx - ty * ty) % mod; y = 2 * tx * ty % mod; if(n & 1) ... Read More
A.暴力, 水题B.n <= 2 都输出-1, 其它必然存在一对满足题意的数, 而且 这对数相邻, 注意到这点的话,就容易做多了,直接暴力找解View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int a[100005], b[100005];int main(){ int i, j, n; scanf("%d", &n); for(i = 0; i < n ;i++) scanf("%d" Read More
View Code #include <cstdio>#include <cstring>#include <algorithm>using namespace std;char map[404][404];int a[404][404]; int n, m, k, sum;__int64 ans;int cnt[33]; int main(){ freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout Read More
A题水题B题:二分View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;int n, m;int a[100005];int main(){ int i, j; freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); while( ~scanf("%d", &n Read More
View Code #include<cstdio>#include<cstring>int q[103], p[103], s[103], pp[103];int n, k, a, b;int main(){ int i, j; scanf("%d%d", &n, &k); for(i = 1; i <= n; i++) scanf("%d", &q[i]); for(i = 1; i <= n; i++) scanf("%d", &s[i]); //求解操作1的周 Read More