本文共 1665 字,大约阅读时间需要 5 分钟。
RK法:https://www.cnblogs.com/16crow/p/6879988.html
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define debug() puts("++++")#define gcd(a,b) __gcd(a,b)#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define fi first#define se second#define pb push_back#define sqr(x) ((x)*(x))#define ms(a,b) memset(a,b,sizeof(a))#define sz size()#define be begin()#define mp make_pair#define pu push_up#define pd push_down#define cl clear()#define lowbit(x) -x&x#define all 1,n,1#define rep(i,x,n) for(int i=(x); i<=(n); i++)#define in freopen("in.in","r",stdin)#define out freopen("out.out","w",stdout)using namespace std;typedef long long LL;typedef unsigned long long ULL;typedef pair P;const ULL base = 100000007;//33951943const int INF = 0x3f3f3f3f;const LL LNF = 1e18;const int maxn = 16000005+20;const int maxm = 1e6 + 10;const double PI = acos(-1.0);const double eps = 1e-8;const int dx[] = {-1,1,0,0,1,1,-1,-1};const int dy[] = { 0,0,1,-1,1,-1,1,-1};int dir[4][2] = { { 0,1},{ 0,-1},{-1,0},{ 1,0}};const int mon[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};const int monn[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int t,n,m;char s[maxn];int has[maxn],a[150];int main(){ while(~scanf("%d%d",&n,&m))//将字符串对应到m进制数 { set st; ms(a,0),ms(has,0); int cnt=0,sum=0,num=0; scanf("%s",s); int len = strlen(s); //按照字符出现的先后顺序确定字符的大小 for(int i=0;i
转载于:https://www.cnblogs.com/Roni-i/p/9447830.html