摘要:
同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)