Heim  >  Artikel  >  Web-Frontend  >  Codeforces Beta Round #4 (Div. 2 Only) C. Registration system_html/css_WEB-ITnose

Codeforces Beta Round #4 (Div. 2 Only) C. Registration system_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:53:101061Durchsuche

这个题感觉还不错,以前字典树写的是最顺手的,这几次比赛屡屡挂在字典树上也是有阴影了啊~~



题目大意:

给出一些字符串,对每个字符串进行查询,若没出现过返回OK,若出现过就生成新字符串,格式为原字符串+数,数为这个字符串第几次重复出现。



解题思路:

字典树,对于每个字符串的插入次数进行计数。



下面是代码:

#include <set>#include <map>#include <queue>#include <math.h>#include <vector>#include <string>#include <stdio.h>#include <string.h>#include <stdlib.h>#include <iostream>#include <cctype>#include <algorithm>#define eps 1e-10#define pi acos(-1.0)#define inf 107374182#define inf64 1152921504606846976#define lc l,m,tr 0 ? (x) : -(x))#define clear1(A, X, SIZE) memset(A, X, sizeof(A[0]) * (min(SIZE,sizeof(A))))#define clearall(A, X) memset(A, X, sizeof(A))#define memcopy1(A , X, SIZE) memcpy(A , X ,sizeof(X[0])*(SIZE))#define memcopyall(A, X) memcpy(A , X ,sizeof(X))#define max( x, y )  ( ((x) > (y)) ? (x) : (y) )#define min( x, y )  ( ((x)   <br>  <br>  <p></p> </algorithm></cctype></iostream></stdlib.h></string.h></stdio.h></string></vector></math.h></queue></map></set>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn