- 博客(196)
- 收藏
- 关注
原创 tjut 3948
include#include#include#include#include#include#includeusing namespace std;typedef long long LL;const int N=200000+10;char s[N],s1[N];struct SuffixArray{ int a1[N],a2[N],c[N],SA[N],sa[N
2016-08-31 22:31:48 197
原创 tjut 1403
#include #include #define max 1000010 int wa[max],wb[max],wv[max],ws[max]; int rank[max],height[max]; int sa[max],r[max]; char str[max*2]; int cmp(int *r,int a,int b,int l) {
2016-08-31 19:39:15 160
原创 tjut 3526
#include #include #include using namespace std;const int N=5005;const int M=1000001;const int inf=1<<30;int cnt,n,m,s,t;int head[N];int NN;struct Edge{ int v,next,w;}edge[M];void addedge
2016-08-31 17:34:43 145
原创 tjut 3529
# include # include # include # include # define MAXM 20 # define MAXN 60000 # define MAXL 300 # define INF 0x7FFFFFFF using namespace std; char s[MAXM][MAXM]; int L[MAXN], R
2016-08-31 17:14:15 187
原创 tjut 3534
#include #include const int N=500000; const int inf=0x3fffffff; int head[N],num,Len[N],ans,node[N],k; struct edge { int ed,w,next; }e[N*2]; void addedge(int x,int y,int w) {
2016-08-31 15:55:43 154
原创 tjut 3525
#include #include #include #include #include using namespace std; const int maxn=200100; vector va,vb,data,dp; vector > v; set sa,sb; int da[maxn],db[maxn],n,m; voi
2016-08-31 09:51:32 164
原创 tjut 3524
#include using namespace std; typedef long long ll; const ll mod=10007; ll pow(ll n) { ll ans=1,base=2; while(n) { if(n&1) ans=ans*base%mod; base=base*b
2016-08-31 09:35:12 156
原创 tjut 3530
#include struct mart { double mat[105][105]; }; mart kk,xx; int n; mart multi(mart a,mart b) { mart c; int i,j,k; for(i=1;i<=n;i++) for(j=1;j<=n;j
2016-08-31 08:55:51 150
原创 tjut 3519
#include #include using namespace std; const int mod = 10007; int n; struct matrax { int m[4][4]; }; matrax A={ 1,1,0,2, 1,0,0,0, 0,1,0,0, 0,0,0,2 }; matrax
2016-08-31 08:18:17 154
原创 tjut 3518
#include #include #define max 11000 int wa[max],wb[max],wv[max],ws[max]; int rank[max],height[max]; int cmp(int *r,int a,int b,int l) { return r[a]==r[b]&&r[a+l]==r[b+l]; } void
2016-08-31 08:06:40 158
原创 tjut 3509
#include #include #include using namespace std; typedef long long LL; const int N=55; LL x[N][N],y[N][N],s[N][N]; LL A[N],B[N],F1[N],F2[N],tmp; int f1,f2,a,b,K,n,m; int i,j,
2016-08-30 10:32:51 250
原创 tjut 3508
#include#includeusing namespace std;//const int MOD=1000000007;int vis[40100]; //标记是否是素数int q[12000]; //质数int main(){memset(v
2016-08-30 09:53:11 255
原创 tjut 3511
#include#include#include#include#include#include#includeusing namespace std;const int maxn = 51111;const double eps = 1e-8;inline int dcmp(double x) {return (x > eps) - (x < -eps);}inline d
2016-08-30 08:34:18 290
原创 tjut 3516
#include#include#includeusing namespace std;const int maxn=1010;const int infinity=(-1)^(1<<31);int dp[maxn][maxn];int s[maxn][maxn];struct point{ int x,y;}p[maxn];int S(int i,int k,int
2016-08-30 07:58:24 247
原创 tjut 2871
#include #include #include using namespace std; #define lson 2*i #define rson 2*i+1 #define lc l,mid,2*i #define rc mid+1,r,2*i+1 const int L = 50000+10; struct node {
2016-08-29 23:40:37 239
原创 poj 3667
#include #define lson l, m, rt<<1#define rson m+1, r, rt<<1|1const int maxn = 50000;int n, mNum, op, a, b;int sum[maxn*3], lsum[maxn*3], rsum[maxn*3], cover[maxn*3];void BuildTree(int l, int
2016-08-29 22:29:15 263
原创 tjut 2795
#include #include #include using namespace std; #define L l,m,u<<1 #define R m+1,r,u<<1|1 //u*2+1 const int N=200000+10; int h,w,n; int a[N<<2]; void build(int l,int r,int
2016-08-29 19:23:53 246
原创 poj 2778
#include #include #include #include #include using namespace std; const int MAX_N = 10 * 10 + 5; //最大结点数:模式串个数 X 模式串最大长度 const int CLD_NUM = 4; //从每个结点出发的最多边数:本题是4
2016-08-27 13:30:16 364
原创 tjut 2896
#include#include#include/*寻找都有哪些子串不能保证是字母或数字,所以子节点有差不多130个*/using namespace std;const int N=130;int n,m,tag[520];struct Trie{ int count; //是否为该单词的最后一个节点 Trie *fail; //失败指
2016-08-27 13:05:23 268
原创 tjut 3499
#include #include #include #include #include #include #include using namespace std; typedef __int64 ll; const int N=100010; const int M=500010; const ll inf=1LL<<60;
2016-08-26 11:02:53 182
原创 tjut 3506
#include #include #include using namespace std; const int maxx=2002; int dp[maxx][maxx],mark[maxx][maxx],sum[maxx][maxx]; //dp[i][j]表示第i个猴子到第j个猴子认识的总代价 //mark[i][j]标示最小分割点处的k
2016-08-26 10:20:10 133
原创 tjut 3498
#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define I
2016-08-26 09:44:11 140
原创 poj 3060
#include #include #include #include using namespace std; struct Dictree { bool in; struct Dictree *next[10]; }node[1000000]; Dictree root; int cmp(const void *a,const voi
2016-08-25 22:37:26 227
原创 tjut 4825
#include #include #include using namespace std;//typedef __int64 ll;typedef long long ll;const int M = 55;const int N = M*1e5;struct Node { ll val; int l; int r; void clear
2016-08-25 21:10:35 154
原创 tjut 4287
#include #include int hash[128]; struct TrieNode{ int no;//对应的数字串的编号,这个编号利于后面对出现次数进行统计 TrieNode *next[10]; }node[30005]; TrieNode *root = &node[0]; int cnt,result[5005]; char
2016-08-25 20:32:27 157
原创 tjut 1247
#include #include #include using namespace std; const int MAXN=26; const int MAX=50005; char word[MAX][27]; struct node { bool is; node *next[MAXN]; node() {
2016-08-25 20:14:02 182
原创 tjut 2846
#include #include #include #include using namespace std; int n,m; struct node { int count; int num; //最后插入的字符串是第num个模式串的子串 node *childs[26]; node() {
2016-08-25 20:08:39 224
原创 tjut 3501
#include #include using namespace std;int jisuan(int x){ int i,res=x; for(i=2;i<(int)sqrt(x*1.0)+1;i++) if(x%i==0) { res=res/i*(i-1); while(x%i==0
2016-08-25 17:56:26 137
原创 tjut 3507
#include#include#include#includeusing namespace std;const int MAXN=500010;int dp[MAXN];int q[MAXN];//队列int sum[MAXN];int head,tail,n,m;// dp[i]= min{ dp[j]+M+(sum[i]-sum[j])^2 };int getDP
2016-08-25 16:29:40 111
原创 c++大数模板类
#include #include #include #include using namespace std; #define MAXN 9999 #define MAXSIZE 10 #define DLEN 4 class BigNum { private: int a[500]; //可以控制大数的位数
2016-08-25 16:25:57 346
原创 tjut 3492
#include #include const int maxn = 600 + 10;const double eps = 1e-8;struct Point{ double x, y; Point(double x=0, double y=0):x(x), y(y) {}}p[maxn];int dcmp(double x){ if(fabs(x) <
2016-08-25 15:13:16 141
原创 tjut 3491
#include #include #include #include #include #include #include #include #include #include #include #pragma comment (linker,"/STACK:102400000,102400000") #define pi a
2016-08-25 11:01:59 187
原创 tjut 3488
#include #include #include #include #include using namespace std;int N, M;const int INF = 0x3f3f3f3f;int w[205][205];int lx[205], ly[205];int sx[205], sy[205];int match[205], slack[205];
2016-08-25 10:22:58 133
原创 tjut 3496
#include #include #include using namespace std;const int MAX = 999999;int val[111],time[111],dp[111][1111];int main(){ int t; scanf("%d",&t); while(t--) { int n,m,l;
2016-08-25 09:47:08 148
原创 poj 2046
#include #include #include #include using namespace std; #define MAXN 1000010 char pattern[MAXN]; int next[MAXN]; void getNext(){ int m = strlen(pattern); next[0] =
2016-08-24 22:50:41 246
原创 hust 1010
#include #include #include #include using namespace std; #define MAXN 1000010 char pattern[MAXN]; int next[MAXN]; void getNext(){ int m = strlen(pattern); next[0] =
2016-08-24 22:42:32 225
原创 tjut 2203
#include#include#include#includeusing namespace std;#define MAXN 200010char text[MAXN];char pattern[MAXN];int next[MAXN];void getNext(){ int m = strlen(pattern); next[0] = next[1] =
2016-08-24 22:32:15 146
原创 tjut 1686
#include#include#include#includeusing namespace std;#define MAXN 1000010int t , ans;char text[MAXN];char pattern[MAXN];int next[MAXN];/*预处理出next数组*/void getNext(){ int m = strlen(patt
2016-08-24 22:24:58 131
原创 tjut 2594
#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; char a[50009],b[50009]; int next
2016-08-24 21:56:31 108
原创 tjut 2087
#include#includechar b[1000001];char a[1000010];int p[1000001];int m,n;void getp(){ p[1]=0; int i,j=0; for(i=2;i<=m;i++){ while(j>0&&b[j+1]!=b[i]) j=p[j]; if(b[j+1]==
2016-08-24 21:19:20 134
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人