摘要:
DescriptionElina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as foll... 阅读全文
摘要:
DescriptionBeads of red, blue or green colors are connected together into a circular necklace of n beads ( n _ 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 8 const int MAXN = 25; 9 10 int n, m = 3;11 bool vis[MAXN];12 13 LL power(LL x, int p) {14 LL ret =... 阅读全文
摘要:
Let's imagine how apple tree looks in binary computer world. You're right, it looks just like a binary tree, i.e. any biparous branch splits up to exactly two new branches. We will enumerate by integers the root of binary apple tree, points of branching and the ends of twigs. This way we may 阅读全文
摘要:
You are the King of Byteland. Your agents have just intercepted a batch of encrypted enemy messages concerning the date of the planned attack on your island. You immedietaly send for the Bytelandian Cryptographer, but he is currently busy eating popcorn and claims that he may only decrypt the most i 阅读全文
摘要:
DescriptionYou may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as height, colour, wrinkles, ears, eyebrows and the like. A few bear no human resemblance; these typically have geometric or amorphous shapes like cubes, oil slicks or clouds o 阅读全文
摘要:
DescriptionA substring of a stringTis defined as:T(i,k)=TiTi+1...Ti+k-1, 1≤i≤i+k-1≤|T|.Given two stringsA,Band one integerK, we defineS, a set of triples (i,j,k):S= {(i,j,k) |k≥K,A(i,k)=B(j,k)}.You are to give the value of |S| for specificA,BandK.InputThe input file contains several blocks of data. 阅读全文
摘要:
DescriptionThe repetition number of a string is defined as the maximum numberRsuch that the string can be partitioned intoRsame consecutive substrings. For example, the repetition number of "ababab" is 3 and "ababa" is 1.Given a string containing lowercase letters, you are to fin 阅读全文
摘要:
DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = " 阅读全文
摘要:
The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. Robots» security service would have already started an undercover operation to establish the agent 阅读全文
摘要:
Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. T 2 #include 3 #include 4 #include 5 using namespace std; 6 typedef long long LL; 7 8 const int MAXN = 50010; 9 10 int sa[MAXN], c[MAXN], rank[MAXN], height[MAXN], tmp[MAXN];11 char s[MAXN];... 阅读全文