This post is all about the solution of the A. GamingForces Educational Codeforces Round 142 (Rated for Div. 2) Problem solution.
Problem Statement :
Monocarp is occupied with a computer game. He's going to kill n monsters, one of which has high health.
Monocarp's character possesses two spells that he can cast an arbitrary number of times (possibly zero) and in any order:
Select exactly two alive monsters and reduce their health by one; select a single monster and kill it.
A monster dies when its health reaches zero.
What is the bare minimum of spell casts Monocarp should make in order to kill all monsters?
Format of Input :
Each test contains a number of test cases. The first line contains the number t (1t500) of test cases. The test cases are described below.
A test case's only line contains the string s (3|s|100) — the capybaras' names written together. The string only contains the English letters 'a' and 'b'.
The sum of string lengths across all test cases is guaranteed not to exceed 500.
Format of the Output :
For every test case, print three strings a, b, and c separated by spaces on a single line — capybara names, such that writing them without spaces results in a line s. ab and cb, or ba and bc, must be satisfied.
If you have several options for restoring the names, print any of them. If the names are unable to be recovered, print ":(" (without quotes)
Also Check this out:-
A. GamingForces Educational Codeforces Round 142 (Rated for Div. 2) Problem solution, Click Here
B. Stand-up Comedian Educational Codeforces Round 142 (Rated for Div. 2) Problem solution, Click Here
C. Min Max Sort Educational Codeforces Round 142 (Rated for Div. 2) Problem solution, Click Here
D. Fixed Prefix Permutations Educational Codeforces Round 142 (Rated for Div. 2) Problem solution, Click Here
E. Divisors and Table Educational Codeforces Round 142 (Rated for Div. 2) Problem solution, Click Here
Solution of the Problem: Click Here
0 Comments