/.../
: Start and end regex delimiters|
: Alternation()
: Grouping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAXN 100000 | |
#define MAX_LOG 17 | |
int n,s[MAXN+5]; | |
int st[MAX_LOG+1][MAXN+5]; | |
inline void init(){/*假設區間由[0~n-1]*/ | |
for(int i=0;i<n;++i)st[0][i]=s[i]; | |
for(int j=1;(1<<j)<=n;++j) | |
for(int i=0;i+(1<<j)<=n;++i) | |
st[j][i]=min(st[j-1][i],st[j-1][i+(1<<(j-1))]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//shihongzhi -- 2012.3.9 | |
#include <stdio.h> | |
#include <string.h> | |
void KMP(char *T, char *P, int *pi) | |
{ | |
int tLen = strlen(T); | |
int pLen = strlen(P); | |
int k = 0; | |
for (int i=0; i<tLen; ++i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
int buildlps (char * pat, int m, int *lps){ | |
lps[0] = lps[1] = 0; | |
for(int i=2; i<=m; i++){ | |
int j = lps[i-1]; | |
while(1){ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a | |
ai | |
am | |
an | |
ang | |
anh | |
ao | |
au | |
ay | |
ba |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def no_accent_vietnamese(s): | |
s = s.lower() | |
s = re.sub('[áàảãạăắằẳẵặâấầẩẫậ]', 'a', s) | |
s = re.sub('[éèẻẽẹêếềểễệ]', 'e', s) | |
s = re.sub('[óòỏõọôốồổỗộơớờởỡợ]', 'o', s) | |
s = re.sub('[íìỉĩị]', 'i', s) | |
s = re.sub('[úùủũụưứừửữự]', 'u', s) | |
s = re.sub('[ýỳỷỹỵ]', 'y', s) | |
s = re.sub('đ', 'd', s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://daynhauhoc.com/t/share-code-doc-so-thanh-chu-so-lon-bao-nhieu-cung-can-tat/62701/ | |
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
#include <exception> | |
#include <cassert> | |
#ifdef __unix__ | |
#include <clocale> | |
#elif defined _WIN32 || defined _WIN64 | |
#include <fcntl.h> //_O_WTEXT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import regex as re | |
uniChars = "àáảãạâầấẩẫậăằắẳẵặèéẻẽẹêềếểễệđìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵÀÁẢÃẠÂẦẤẨẪẬĂẰẮẲẴẶÈÉẺẼẸÊỀẾỂỄỆĐÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴÂĂĐÔƠƯ" | |
unsignChars = "aaaaaaaaaaaaaaaaaeeeeeeeeeeediiiiiooooooooooooooooouuuuuuuuuuuyyyyyAAAAAAAAAAAAAAAAAEEEEEEEEEEEDIIIOOOOOOOOOOOOOOOOOOOUUUUUUUUUUUYYYYYAADOOU" | |
def loaddicchar(): | |
dic = {} |