test
-
[HackerRank] Tower Breakers c++Coding Test/HackerRank 2022. 7. 20. 19:20
Problem Two players are playing a game of Tower Breakers! Player 1 always moves first, and both players always play optimally.The rules of the game are as follows: Initially there are n towers. Each tower is of height m. The players move in alternating turns. In each turn, a player can choose a tower of height x and reduce its height to y, where 1
-
[HackerRank] Diagonal Difference c++Coding Test/HackerRank 2022. 7. 16. 20:58
problem Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix is shown below: 1 2 3 4 5 6 9 8 9 The left-to-right diagonal = 1 + 5 + 9. The right to left diagonal = 3 +5 +9. Their absolute difference is |15-17| = 2. sample input 3 11 2 4 4 5 6 10 8 -12 output 15 solution 왼쪽방향 대각선, 오른쪽 방향 대각선의 원소들의 합을 구한뒤 둘의 차를 구하는 문제이다. sample ..