Completing a Chess Set
InterviewTime limit1sMemory limit128 MB
Given counts of six white chess piece types, output how many of each must be added or removed to reach a complete 16-piece set.
- Level
Easy1 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
Donghyuk found an old chessboard and some chess pieces while looking through a storage room.
After cleaning the board, it was usable enough. All black pieces were present, but the number of white pieces was not correct.
A complete set of white chess pieces has 16 pieces: 1 king, 1 queen, 2 rooks, 2 bishops, 2 knights, and 8 pawns.
Given the number of white pieces Donghyuk found in that order, determine how many pieces of each type must be added or removed to make a complete set.
Input
The first line contains six integers: the numbers of white kings, queens, rooks, bishops, knights, and pawns that Donghyuk found, in that order.
Each integer is between 0 and 10, inclusive.
Output
Print six integers in the same order as the input. Each integer is the number of pieces of that type that must be added or removed.
A positive value means that many pieces must be added. A negative value means that many pieces must be removed.