Algorithm
Problem Name: beecrowd | 2862
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2862
Insect!
By Ricardo Martins, IFSULDEMINAS Brazil
Timelimit: 1
Devita is the prince of the Calsadins. Together with Pana, they go after Tataroko, the birth name of Kogu, to try to dominate the world. It has a tracker that measures the energy level of any living being. All beings with the level less than or equal to 8000, it considers as if it were an insect ("Inseto"). When he passes this value, which was the case of Kogu, he is astonished and shouts "Mais de 8000", that means "It's over 8000". Based on this, use the same technology and analyze the energy level of living things.
Input
The input is composed of several test cases. The first line contains an integer C relative to the number of test cases. Then there will be C rows, with an integer N (100 <= N <= 100000) relative to the energy level of a living being.
Output
For each value read, print the corresponding text.
Input Sample | Output Sample |
3 |
Mais de 8000! |
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int>v(n);
for (int i = 0; i < n; ++i)
{
int x;
cin >> x;
if (x < = 8000)
cout << "Inseto!" << endl;
else
cout << "Mais de 8000!" << endl;
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
Output
#2 Code Example with C# Programming
Code -
C# Programming
using System;
//Developed by: @LucasMarcuzo
namespace _2862___Inseto_
{
class Program
{
static void Main(string[] args)
{
int c = int.Parse(Console.ReadLine());
for (var i = 0; i < c; i++)
{
int x = int.Parse(Console.ReadLine());
if(x > 8000)
{
Console.WriteLine("Mais de 8000!");
}
else
{
Console.WriteLine("Inseto!");
}
}
}
}
}
Copy The Code &
Try With Live Editor
Input
Output
#3 Code Example with Java Programming
Code -
Java Programming
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner leitor = new Scanner(System.in);
int C = leitor.nextInt();
for (int i = 0; i < C; i++) {
int N = leitor.nextInt();
if (N > 8000)
System.out.println("Mais de 8000!");
else
System.out.println("Inseto!");
}
}
}
Copy The Code &
Try With Live Editor
Input
Output
#4 Code Example with Javascript Programming
Code -
Javascript Programming
const { readFileSync } = require("fs")
const [numLines, ...input] = readFileSync("/dev/stdin", "utf8")
.split("\n")
.map(value => Number.parseInt(value, 10))
function main() {
const output = Array.from(
{ length: numLines },
(_, index) => input[index] <= 8000 ? "Inseto!" : "Mais de 8000!"
)
console.log(output.join("\n"))
}
main()
Copy The Code &
Try With Live Editor
Input
Output
#5 Code Example with Python Programming
Code -
Python Programming
c = int(input())
while c > 0:
c -= 1
n = int(input())
if n > 8000:
print('Mais de 8000!')
else:
print('Inseto!')
Copy The Code &
Try With Live Editor
Input
Output