上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 182 下一页
摘要: 多重背包,但由于是bool型,可以使用特殊方法优化效率使得效率与01背包相同View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 15#define maxc 100005int cash;int n;int num[maxn], denomination[maxn];bool f[maxc];int used[maxc];void input(){ scanf(" 阅读全文
posted @ 2013-03-08 16:59 undefined2024 阅读(760) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define maxn 55#define maxm 22int n, m;int card[maxn];bool vis[maxn * maxm];void input(){ for (int i = 0; i < n; i++) scanf("%d", &a 阅读全文
posted @ 2013-03-05 20:19 undefined2024 阅读(213) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxl 105int ans;int cal(char ch, int d){ if (ch == 'Y') return max(500, d); if (ch == 'B') return int(1.5 * d + 0.5); return 2 * d;}void input(){ c 阅读全文
posted @ 2013-03-05 20:17 undefined2024 阅读(273) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 105bool unlocked[maxn];int main(){ int t; scanf("%d", &t); while (t--) { memset(unlocked, 0, sizeof(unlocked)); int n; scanf("%d", &am 阅读全文
posted @ 2013-02-28 13:47 undefined2024 阅读(141) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>#include <cmath>using namespace std;#define maxn 55int n;int f[maxn];int gcd(int a, int b){ if (b > 0) return gcd(b, a % b); return a;}void input(){ for (int i = 0; i < n; i++) sc 阅读全文
posted @ 2013-02-26 13:50 undefined2024 阅读(202) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 182 下一页