CARRHIM - Can you play carrom !!!
Carrom board is a very popular game. There are four player in this game in dual player mode. In dual player game the team is pair with opposite side player.
So, in picture you see the board and the player’s. Where the player A and the player C in team-1, the player B and the player D in team-2.
In this game a team is play with one color pawn. So, if team-1 start playing the board they take the white pawn, and the team-2 get the black pawn for the game. If team-1 can cover all the pawn before the team-2 and the red also covered by the time then the team-1 will win. Otherwise team-2 will win if they cover their all pawn in the game.
Now, There are 9 white pawn and 9 black pawn and one red pawn in the board. The game is played by different rule.
In my problem of this game the rule like,
The point for the one pawn is 1 and for red is 5.
You can assume that which player 1st start playing the game is start with the white pawn.one team must cover red pawn and this team will get the red point.And you know the penalty rule is If one player cover one pawn of opposite team then the turn goes to the next player.
Now your task is to find the winner team & points.
The points count by the remaining of pawn in the board and plus the covered red pawn point by the winning team.
Input consists of pairs of lines (at most 100 lines). Each pair contains 1 charecter and 3 integer.A first charecter is the player id(A , B , C or D) and three integer is W, B, R (1<= W, B<=9) separated by a space that is number of white, black and red pawn the player cover in his turn.The end of one input occurs when the first sequence starts with an "#" character (without the quotes).
For each case if the game complete then you have to print a string “Team-1 win and the point is N.” (without the quotes) when team-1 win , Otherwise “Team-2 win and the point is N.” (without the quotes).
If the game is incomplete then print a string "Incomplete game." (without the quotes) when a team can not cover all the pawn of his turn.
N is the total point of winner team. See the sample input/output for exact formatting.
A 5 1 0
B 1 2 0
C 2 1 1
D 1 0 0
B 1 1 0
C 1 2 0
D 3 1 1
A 1 2 0
B 3 0 0
A 1 1 0
B 1 5 1
C 1 1 0
Team-1 win and the point is 10.
Team-2 win and the point is 8.
For the first input player A start the game so the team-1 play with the white pawn.
After all input the team-1 cover all of white pawn also the red pawn.
and there are 5 black pawn remain in the board.
so, team-1 win and the point is 5+5=10.
Problem setter: Md. Hashibul Amin Hemel, Dept. of CSE
Bangladesh University of Business and Technology (BUBT)
can someone post answer here
If a team covers all the nine pawns first, it is the winner irrespective of the red pawn covered or not.
Nice Problem... :D :D
easy question , but language is not proper . After getting 10 WA , finally did it .
What a problem! So lengthy!Last edit: 2016-08-18 13:34:04
Nice pblm :)
hint: use string to check EOF instead of char in c++..
It is to be noted that, red could be won by anyone, not required to be won by the team with all white or all black.Last edit: 2015-04-07 02:20:24
what if team 1 covers all white pawns and team 2 covers 7 black pawns and red one also.. then what shld be the answer????
Vamsi Krishna Avula:
easily one of my longest codes!