上一页 1 ··· 147 148 149 150 151 152 153 154 155 ··· 182 下一页
摘要: 欧拉函数,n每扩大一个,就会有euler(n)个数字加入到集合中,所以欧拉函数的前n项和即为所求。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 1000006long long phi[maxn], num[maxn];int n;int main(){ //freopen("t.txt", "r", stdin); int 阅读全文
posted @ 2011-05-22 10:49 undefined2024 阅读(225) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 100005int f[maxn], pos[maxn];int main(){ //freopen("t.txt", "r", stdin); int n; while (scanf("%d", &n), n != 0) { for (int i 阅读全文
posted @ 2011-05-22 10:28 undefined2024 阅读(244) 评论(0) 推荐(0)
摘要: 二分图匹配,每个点只判断与其周围各点的匹配情况,难点在于对于一个编号求期所在的行列,以及对于给出的坐标求编号。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 70int n, m, h;bool map[maxn][maxn];int xM[maxn * maxn], yM[maxn * maxn];bool chk[maxn * maxn];int uN, vN;i 阅读全文
posted @ 2011-05-22 09:25 undefined2024 阅读(649) 评论(0) 推荐(0)
摘要: 用map,c++就可以过View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <map>#include <algorithm>using namespace std;#include <string>#define maxn 1000005map<string, int> tree;string st, name[maxn];int ncount = 0, tot = 0 阅读全文
posted @ 2011-05-21 16:21 undefined2024 阅读(571) 评论(0) 推荐(1)
摘要: 题意:给定一个长宽小于等于11的矩形,问用1×2的小矩形填满,有多少种方法。分析:状态压缩dp,f[i][j]表示第i行,状态为j的情况有多少种。设置一个match函数,用来检测可不可以由前一行的状态a到后一行的状态b,如果可以,则f[i][a]+=f[i - 1][b];match可以分为一下情况考虑,两个都为0不可以,一个为0一个为1可以(不放,或竖着放),两个都为一(横着方,需要检查下一列是否为1,然后直接i<<=2越过一列)。View Code #include <iostream>#include <cstdio>#include < 阅读全文
posted @ 2011-05-21 15:49 undefined2024 阅读(2576) 评论(1) 推荐(1)
上一页 1 ··· 147 148 149 150 151 152 153 154 155 ··· 182 下一页