Algorithm


Problem Name: 2 AD-HOC - beecrowd | 2650

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2650

Building Walls

 

By Abner Samuel P. Palmeira, IFSULDEMINAS BR Brazil

Timelimit: 1

After the colossal titan destroys the Maria wall, the exploration troop has decided to build a new wall, this wall will be so hard that no titan can break it.

But if the titan is too tall he can simply jump over the wall, because of this the Exploration Army hired you to write a program, that given the height of the wall and the size of the knowed titans, answer which Titans will be able To pass over the wall.

A titan can jump over a wall only if it is taller than the wall.

 

Input

 

The first line contains two integers N (1 ≤ N ≤ 100) and W (1 ≤ W ≤ 1000) representing respectively how many titans the Exploration Troop knows and the size of the wall they intend to build.

Each of the following N lines contains a string S (1 ≤ |S| ≤ 100) representing the name of the titan, followed by an integer H (1 ≤ H ≤ 1000) representing the height of the titan. The string is composed of uppercase, lowercase letters and spaces.

The name of a titan never begins or ends with space.

 

Output

 

Your show should show which titans will be able to pass over the wall, the titans should be displayed in the order they appear at the entrance.

 

 

 

Input Sample Output Sample

3 50

Titan Colossal 60

Titan Encoracado 15

Titan Femea 14

Titan Colossal

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>
#include <string.h>

int main (void)
{

	char titan[110];
	unsigned short qtdTitan, tamMuralha, i, alturaTitan, tamanho;

	scanf("%hu %hu", &qtdTitan, &tamMuralha);

	for (i = 0; i  <  qtdTitan; i++)
	{	
		//"%[a-z A-Z]" para ignorar números;
		scanf(" %[a-z A-Z] %hu", titan, &alturaTitan);
		tamanho = strlen(titan);

		if (tamMuralha  <  alturaTitan)
		{	
			// Escrever 0 na última posição da string para eliminar
			// o espaço que fica na impressão;
			titan[tamanho-1] = 0;
			printf("%s\n", titan);
		}
	}
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 50
Titan Colossal 60
Titan Encoracado 15
Titan Femea 14

Output

x
+
cmd
Titan Colossal
Advertisements

Demonstration


Previous
#2635 Beecrowd Online Judge Solution 2635 Web Browser Solution in C, C++, Java, Js and Python
Next
#2653 Beecrowd Online Judge Solution 2653 Dijkstra Solution in C, C++, Java, Js and Python