上一页 1 ··· 84 85 86 87 88 89 90 91 92 ··· 182 下一页
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;#define maxn 105#define maxm 300int n, x, d;char s[maxn], p[maxn], c[maxn], m[maxn];int spos[maxm];void input(){ scanf("%s%s%s", s, p, c);} 阅读全文
posted @ 2011-08-27 10:51 undefined2024 阅读(178) 评论(0) 推荐(0)
摘要: dfs+剪枝题意:给定一个分数,问用分子为1的分数加和来构成这个分数有多少种方式。要求每种情况分数的个数不超过n,分母乘积不超过a。分析:dfs+剪枝,记录当前剩余的需要构成的分数值,然后试图用所有的可以使用的名额平分这个剩余值,再试图用一个分数构成这个剩余值,这样就确定了我要枚举当前分母的范围。并随时检查所有分母的乘积是否超限。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>usingnamespace std;#define m 阅读全文
posted @ 2011-08-25 21:24 undefined2024 阅读(597) 评论(0) 推荐(0)
摘要: 题意:给定一个长度为n的01序列,作为矩阵的第一行,每次把本行的最后一位挪到第一位,其余各位向后移一位,构成新的序列,作为下一行,最终形成n*n的矩阵。把矩阵各行交换位置,使得从上到下各序列按字典序从小到大排列,又得到了n*n的矩阵。给出矩阵的最后一列,求矩阵的第一行。分析:我们发现这个矩阵有个特点。将矩阵的每行看作一个01序列,得到一个序列集合A。然后将矩阵的最后一列移到第一列,其余列后移,然后将没行看作一个01序列,得到一个序列集合B。A与B一定是同一个集合。根据这个性质我们可以进一步得知,把后来经过列移动的矩阵按行字典序排序后可得到排序后的原矩阵。在这个排序变换过程中如果我们只关注矩阵的 阅读全文
posted @ 2011-08-24 12:20 undefined2024 阅读(638) 评论(0) 推荐(0)
摘要: 解一元二次方程简单题打表View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;//int last(long long x)//{// long long l = x * (x - 1);//// y * (2 * x + 1 + y) == l;//// y * y + (2 * x + 1) * y - l == 0;// long long b = 阅读全文
posted @ 2011-08-24 09:51 undefined2024 阅读(316) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 25int n;bool map[maxn][maxn][maxn];void input(){ memset(map, 0, sizeof(map)); for (int i = 1; i <= n; i++) { int a; int j = 1; while (scanf("%d", 阅读全文
posted @ 2011-08-21 12:53 undefined2024 阅读(183) 评论(0) 推荐(0)
上一页 1 ··· 84 85 86 87 88 89 90 91 92 ··· 182 下一页