摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 30#define maxl 1005bool f[maxn][maxl];int n;void input(){ memset(f, 0, sizeof(f)); scanf("%d", &n); for (int i = 0; i < n; i++) { char st[4]; 阅读全文
posted @ 2011-10-06 15:32
undefined2024
阅读(203)
评论(0)
推荐(0)
摘要:
线段树这种每次在第几个位置插入元素的题,都可以用线段树,从最后一次插入开始来查找每次插入的元素的最终位置。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxl 2000005#define maxn 2005struct Elem{ bool cmd; int p; char ch; int pos;} elem[maxn];struct Node{ Node *pl; N 阅读全文
posted @ 2011-10-06 15:08
undefined2024
阅读(973)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 20int n, m, k;int f[maxn], g[maxn];void input(){ scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < k; i++) scanf("%d", & 阅读全文
posted @ 2011-10-06 10:19
undefined2024
阅读(188)
评论(0)
推荐(0)
摘要:
同2606View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>using namespace std;#define eps 1.0e-8#define maxn 1005struct XPoint{ int x, y;} point[maxn];struct Line{ int a, b; double k; bool end;} line 阅读全文
posted @ 2011-10-06 10:10
undefined2024
阅读(254)
评论(0)
推荐(0)
摘要:
f[n] += 1 + f[i] * (n - i);这个公式可以利用sum(前n项和)进行O(1)的递推。也可以自己根据结果总结规律f[i]= 3 * f[i -1] - f[i - 2];但是快速幂会超时。所以想到有循环节,写个程序找循环节,发现为75000,所以只需要求出前75000个即可。View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 100005#defin 阅读全文
posted @ 2011-10-06 10:02
undefined2024
阅读(189)
评论(0)
推荐(0)