binary array

A collection of 7 post

Count Peaks

Problem Map information is given on an N*N grid. Each grid is marked with the height of that area. The number on each grid that is greater than its top, bottom, left, and right numbers is the peak area. Write a program to find out how many peak regions there are. It is assumed that the edges of the…

Max Grid Sum

Problem Numbers are written on the 5*5 grid as shown below. Given a grid of N*N, output the largest of the sum of each row, the sum of each column, and the sum of the two diagonals. input A natural number N is given in the first line (1<=N<=50). From the second line to the N lines, each line is…

Ranking

Problem Write a program that outputs each student’s rank in the order in which they are entered when the Korean language scores of N (1<=N<=100) students are entered. input N (3<=N<=1000) is input in the first line, and N integers representing the Korean score are input in the second line. If the…

Counting Score

Problem An OX problem is a problem that has two possible answers: right or wrong. In the case of consecutive correct answers in a test made of multiple OX questions, it was decided to calculate the score as follows to give additional points. If the first question is correct, it is counted as 1 point…

Rock Scissor Paper

Problem Two people, A and B, play a rock-paper-scissors game. A total of N games are played, and if A wins, output A, and if B wins, output B. In case of a tie, D is output. Scissors, rock, and paper information will be set to 1: Scissors, 2: Rock, and 3: Paper. For example, if N=5 Round 1 2 3 4…

Visible Students

Problem The teacher lined up N (1<=N<=1000) students. Write a program to find the number of students that the teacher standing in front can see when the heights of the students standing in a line are given in order from the front. (If it is larger than the people standing in front, it is visible, if…

Larger Number

Problem Write a program that takes N (1<=N<=100) integers as input and outputs only the number that is greater than the number immediately preceding itself. (The first number is unconditionally printed.) input A natural number N is given in the first line, and N integers are entered in the next line…