随笔分类 - 模板题目
摘要:P3390 【模板】矩阵快速幂 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 105, mod = 1e9+7; 5 ll n, k; 6 struct MAT
阅读全文
摘要:最短Hamilton路径 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int maxn = 21; 4 int dp[1<<maxn][maxn]; 5 int maps[maxn][maxn]; 6 int main() { 7
阅读全文
摘要:hdu3652 B-number 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 15; 4 int dp[maxn][maxn][maxn][maxn]; 5 // dp[i][j][state][r] i表
阅读全文
摘要:hdu2089 不要62 1 #include <bits/stdc++.h> 2 using namespace std; 3 int dp[15][15], d[15]; 4 void init() { 5 dp[0][0] = 1; 6 for (int i = 1; i <= 7; i++)
阅读全文
摘要:P1880 [NOI1995]石子合并 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 205; 4 const int inf = 0x3f3f3f3f; 5 int cost1[maxn][maxn], c
阅读全文
摘要:P2444 [POI2000]病毒 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 35000; 4 5 struct Aho_Corasock_Automaton { 6 struct node { 7 in
阅读全文
摘要:noi7219 复杂的整数划分问题 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 55; 4 int dp1[maxn][maxn], dp2[maxn][maxn], dp3[maxn][maxn], dp
阅读全文
摘要:POJ3468 A Simple Problem with Integers 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <cmath> 5 using namespace std; 6 ty
阅读全文
摘要:POJ3275 Ranking the Cows 1 #include <iostream> 2 #include <cstdio> 3 #include <bitset> 4 using namespace std; 5 const int maxn = 1005; 6 int n, m; 7 b
阅读全文
摘要:P4779 【模板】单源最短路径(标准版) 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 1e5+5, inf = 0x3f3f3f3f; 5 struct E
阅读全文
摘要:P3371 【模板】单源最短路径(弱化版) 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int maxn = 10005; 4 struct edge { 5 int v, w; 6 }; 7 vector<edge> maps[
阅读全文
摘要:P3385 【模板】负环 Bellman-Ford 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 2005, maxm = 3005; 4 const int inf = 0x3f3f3f3f; 5 stru
阅读全文
摘要:Holy Grail Bellman-Ford 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 305, maxm = 505; 4 const int inf = 0x3f3f3f3f; 5 struct e
阅读全文
摘要:hdu6470 Count 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 6, mod = 123456789; 5 6 struct MAT { 7 ll a
阅读全文
摘要:P3649 [APIO2014]回文串 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int maxn = 300010; 5 char s[maxn]; 6 int n; 7 st
阅读全文
摘要:POJ2774 Long Long Message 两串求最长公共子串 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 con
阅读全文
摘要:P3975 [TJOI2015]弦论 在原串所有子串中求字典序第k大的子串 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 1e6+5; 4 char s[maxn]; 5 int a[maxn], c[max
阅读全文
摘要:P2408 不同子串个数 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 1e5+5; 4 typedef long long ll; 5 char s[maxn]; 6 int sa[maxn], t[max
阅读全文
摘要:P3804 【模板】后缀自动机 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 2e6+5; 4 typedef long long ll; 5 char s[maxn]; 6 int a[maxn], c[m
阅读全文
摘要:POJ - 3693 Maximum repetition substring 题意 输入一个串,求重复次数最多的连续重复字串,如果有次数相同的,则输出字典序最小的 Sample input ccabababc daabbccaa # Sample Output Case 1: ababab Cas
阅读全文

浙公网安备 33010602011771号