1 using System; 2 namespace ConsoleApplication2 3 { 4 public class Program 5 { 6 static int[,] martix; 7 8 static string str...
分类:
其他好文 时间:
2015-04-09 14:59:23
阅读次数:
132
#include
using namespace std;
#define maxn 1000000 + 10
int n, m;
int color[maxn];
vector G[maxn];
bool dfs(int u, int c)
{
color[u] = c;
for(int i=0; i<G[u].size(); i++)
{
int...
分类:
其他好文 时间:
2015-04-09 13:52:04
阅读次数:
126
题意:一句话加密。每个单词的前后都要加上"
分析:简单的字符匹配的题。
先预处理需要加密的句子,然后与输入的密文比较。主要是注意积累string的用法,还有本题预处理的方法。
#include
#include
using namespace std;
int main()
{
string a,b,c;
int n;
cin>>n;
b="<3";
whi...
分类:
其他好文 时间:
2015-04-09 13:48:07
阅读次数:
87
4088:题意:判断闭区间a到b之间内的素数个数是否为素数。思路:筛呀筛,不过这里hxy加了一个优化。 1 #include 2 #include 3 using namespace std; 4 5 const int N = 10001; 6 bool prime[N]; 7 int cn...
分类:
编程语言 时间:
2015-04-09 13:28:30
阅读次数:
147
利用Laravel5框架构建Pages的管理功能1.路由Laravel中的路由,跟其他PHP框架一样,作用是把各种请求分流到各个控制器。在`learnlaravel5/app/Http/routes.php`的末尾添加以下代码:Route::group([‘prefix‘=>‘admin‘,‘namespace‘=>‘Admin‘],function(){Route::get(‘/‘,‘Ad..
分类:
其他好文 时间:
2015-04-09 12:12:29
阅读次数:
250
题目大意:给定一个字符串A和一些模板串,要求删除A中所有的模板串后输出
同3942,由于是多串所以把KMP换成AC自动机即可
#include
#include
#include
#include
#define M 100100
using namespace std;
int n;
char s[M],_s[M];
namespace Aho_Corasick_Automaton{...
分类:
其他好文 时间:
2015-04-09 12:03:00
阅读次数:
138
#include
using namespace std;
int search(const int*, int, int);
int main()
{
int arr[6] = {1,2,3,4,10,20};
int find = search(arr, 6, 10);
if(find == -1)
cout
else
cout
return 0;
...
分类:
其他好文 时间:
2015-04-09 11:53:32
阅读次数:
169
题目大意:给定两个串A和B,要求将A中删掉所有的B后输出
为何BC群刚有人问完我这题的【C++语法基础题】版之后就出了个KMP版的= =
维护一个栈,将A中的字符依次加进去,一旦A的栈顶出现了B就弹栈
用KMP算法来加速这个过程即可
#include
#include
#include
#include
#define M 1001001
using namespace std;
...
分类:
编程语言 时间:
2015-04-09 10:39:21
阅读次数:
192
题目大意:给定n个数,每次选择两个数,将两数的异或值计入答案,并删掉其中一个,反复如此直到只剩一个数为止,求答案的最大值
每次将选择的两个数连边,那么显然会得到一棵树
用Prim算法求最大生成树即可
#include
#include
#include
#include
#define M 2020
using namespace std;
int n,a[M];
long long...
分类:
其他好文 时间:
2015-04-09 10:33:10
阅读次数:
161
#include
using namespace std;
#define maxn 1000000 + 10
struct edge
{
int v, dist;
};
int n;
int index = 1;
int M = -1;
vectorG[maxn];
bool vis[maxn] = {false};
void DFS(int u, int dist)
{
...
分类:
其他好文 时间:
2015-04-09 08:58:11
阅读次数:
116