蝙蝠侠大战蜘蛛侠# Joke - 肚皮舞运动
h*n
1 楼
1. Question:
String s is called unique if all the characters of s are different.
String s2 is producible from string s1, if we can remove some characters of
s1 to obtain s2.
String s1 is more beautiful than string s2 if length of s1 is more than
length of s2 or they have equal length and s1 is lexicographically greater
than s2.
Given a string s you have to find the most beautiful unique string that is
producible from s.
Input:
First line of input comes a string s having no more than 1,000,000(10^6)
characters. all the characters of s are lowercase english letters.
Output:
Print the most beautiful unique string that is producable from s
Sample Input:
babab
Sample Output:
ba
Explanation
In the above test case all unique strings that are producible from s are "ab
" and "ba" and "ba" is more beautiful than "ab".
2. Question:
Mastermind is a game of two players. In the beginning, first player decides
a secret key, which is a sequence (s1,s2,...sk) where 0 < si <= n, Then
second player makes guesses in rounds, where each guess is of form (g1,g2, .
..gk), and after each guess first player calculates the score for the guess.
Score for a guess is equal to number of i's for which we have gi = si.
For example if the secret key is (4,2,5,3,1) and the guess is (1,2,3,7,1),
then the score is 2, because g2 = s2 and g5 = s5.
Given a sequence of guesses, and scores for each guess, your program must
decide if there exists at least one secret key that generates those exact
scores.
String s is called unique if all the characters of s are different.
String s2 is producible from string s1, if we can remove some characters of
s1 to obtain s2.
String s1 is more beautiful than string s2 if length of s1 is more than
length of s2 or they have equal length and s1 is lexicographically greater
than s2.
Given a string s you have to find the most beautiful unique string that is
producible from s.
Input:
First line of input comes a string s having no more than 1,000,000(10^6)
characters. all the characters of s are lowercase english letters.
Output:
Print the most beautiful unique string that is producable from s
Sample Input:
babab
Sample Output:
ba
Explanation
In the above test case all unique strings that are producible from s are "ab
" and "ba" and "ba" is more beautiful than "ab".
2. Question:
Mastermind is a game of two players. In the beginning, first player decides
a secret key, which is a sequence (s1,s2,...sk) where 0 < si <= n, Then
second player makes guesses in rounds, where each guess is of form (g1,g2, .
..gk), and after each guess first player calculates the score for the guess.
Score for a guess is equal to number of i's for which we have gi = si.
For example if the secret key is (4,2,5,3,1) and the guess is (1,2,3,7,1),
then the score is 2, because g2 = s2 and g5 = s5.
Given a sequence of guesses, and scores for each guess, your program must
decide if there exists at least one secret key that generates those exact
scores.