摘要:
题意:从某年某月某天开始两个人轮流开始将日期推进,推进方法有两种,1.推进到第二天 2.推进到下个月的这一天。谁到达2001.11.4谁赢,谁超过了谁输。分析:np问题,我们设月号加日号等于d,对于第二种推进方式,会改变d的奇偶性。(因为月的奇偶变了,日的奇偶没变,和的奇偶就变了)。对于第一种推进方式,如果推进后还在同一个月份,那么会改变d的奇偶性。(因为月的奇偶没变,日的变了,和的奇偶就变了)。第一种推进方式,跨月份的时候,有些会改变,有些不会改变。有31天、29天的月份会变,30天、28天的不会变,其中对于d为偶的情况(2月28,4、6月30)可以利用第二中方式变为奇。由此可见对于绝大部分 阅读全文
posted @ 2011-07-09 15:43
undefined2024
阅读(560)
评论(0)
推荐(0)
摘要:
暴力就可以过View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 106struct Device{ int p, b;} dev[maxn][maxn];int s, e, n;int maxb[maxn], minb[maxn], num[maxn];void input(){ scanf("%d", &n); for (int i = 0; 阅读全文
posted @ 2011-07-09 14:42
undefined2024
阅读(1305)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int main(){ //freopen("t.txt", "r", stdin); int a, b; scanf("%d%d", &a, &b); if (a == 0 && b == 0) { printf("Impossible\ 阅读全文
posted @ 2011-07-09 14:22
undefined2024
阅读(183)
评论(0)
推荐(0)
摘要:
题意:给定一个立方体的体积,使其表面积最小,求长宽高(长宽高均为整数)分析:先求其所有因子,然后暴力枚举3条棱的长度,更新最小面积。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>usingnamespace std;#define maxn 10000longlong f[maxn];int main(){ //freopen("t.txt", "r", stdin);int t; scan 阅读全文
posted @ 2011-07-09 14:21
undefined2024
阅读(409)
评论(0)
推荐(0)
摘要:
有两种理解方法。虽然对于相同的数据有不同的输出,但据说都能过。但是我的其中一个没过。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;#define maxn 30005int n, m;int f[maxn], sum[maxn];int main(){ //freopen("t.txt", "r", 阅读全文
posted @ 2011-07-09 10:40
undefined2024
阅读(335)
评论(0)
推荐(0)