摘要: 模拟View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 105int f[maxn][2];int n;void work(){ int page_num = (n + 3) / 4; for (int i = 0; i < page_num * 2; i++) f[i][(i & 1) ^ 1] = i + 1; int j = page_num * 2 阅读全文
posted @ 2013-01-15 19:45 undefined2024 阅读(187) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 105char st1[maxn], st2[maxn];int len;int gcd(int a, int b){ if (a == 0) return 1; b %= a; while (b) { a %= b; swap(a, b); } return a;}int cal(c... 阅读全文
posted @ 2013-01-15 19:11 undefined2024 阅读(249) 评论(0) 推荐(0)
摘要: 记忆化搜索View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 25int a, b, c;int f[maxn][maxn][maxn];int w(int a, int b, int c){ if (a <= 0 || b <= 0 || c <= 0) return 1; if (a > 20 || b > 20 || c > 20 阅读全文
posted @ 2013-01-15 18:47 undefined2024 阅读(301) 评论(0) 推荐(1)
摘要: 题意:有n个湖,每个湖有一个初始的每单位时间的上钩鱼数,在那里钓鱼时该上钩率会以di的速率不断下降,不钓的时候上钩率不变。这n个湖是排成一排的,从第一个湖开始每个单位时间可以选择钓鱼或者往下一个湖走,这些路是单向的不能往回走。给定总时间h,问最多能钓到多少鱼。分析:我们依次枚举究竟要在前多少个湖钓鱼,那么我们可以先将路上的时间计算好,然后人为我们可以在这几个湖之间瞬间转移,每次挑一个上钩率最高的湖去钓即可。View Code #include <iostream>#include <stdio.h>using namespace std;const int maxn=2 阅读全文
posted @ 2013-01-15 18:25 undefined2024 阅读(1908) 评论(0) 推荐(0)
摘要: 本来是离散化的题,当初用了一种比较与众不同的做法View Code #include <iostream>#include <cstdlib>#include <iomanip>using namespace std;const int maxn=500;struct cube{ double l,r,u,d;};void init();void work();void print();void cut(int j);int n,no=0,tot;double ans;cube c[maxn],ls;int... 阅读全文
posted @ 2013-01-15 18:17 undefined2024 阅读(371) 评论(0) 推荐(0)
摘要: 简单题,注意9的倍数的情况View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 1005char st[maxn];int main(){ //freopen("t.txt", "r", stdin); while (scanf("%s", st), strcmp(st, "0")) { int 阅读全文
posted @ 2013-01-15 18:12 undefined2024 阅读(159) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;double cal(int a){ int temp = 1; double ret = 0; for (int i = 1; i <= a; i++) { temp *= i; ret += 1.0 / temp; } return ret + 1; }int main(){ freopen("t.txt", 阅读全文
posted @ 2013-01-15 16:55 undefined2024 阅读(206) 评论(0) 推荐(0)
摘要: 简单模拟View Code #include <iostream>#include <string>using namespace std;string html;void work(){ bool begin=true; int now=0,temp=0,i; string word; while (cin>>word) { if (word=="<br>") { cout<<endl; now=0; continue; }... 阅读全文
posted @ 2013-01-15 16:09 undefined2024 阅读(132) 评论(0) 推荐(0)
摘要: 模拟View Code #include <iostream>using namespace std;const int maxn=32;int byte[maxn];void init(){ int i; for (i=1;i<=31;i++) cin>>byte[i];}int num(int add){ int x=0,temp=1; while (add) { x+=add%10*temp; add/=10; temp*=2; } r... 阅读全文
posted @ 2013-01-15 16:06 undefined2024 阅读(129) 评论(0) 推荐(0)