Algorithm


Problem Name: beecrowd | 1983

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

The Chosen

 

By Victor Jatobá, UNIME BR Brazil

Timelimit: 1

Everyone is talking about the Jatoba Teacher classes. The MEC representatives came to the UNIME of Lauro de Freitas to know more details about this new way of teaching algorithms. In addition, they wanted to select one student to participate in the OBI-Tec (Olympiad Informatics Technical Level) and represent Kroton in the competition, because they know that there are the best. To select the best, they have available a list of the registration number of each student and their respective notes in the discipline. Your task is to help the Ministry of Education staff to find students better able to represent the institution and who knows guarantee your place. If the highest score is not greater than or equal to 8, you should print "Minimum note not reached" .

 

Input

 

The file first contains the number of students (3 <= n <= 100) and then the n students bearing the registration number (0 < m < 1000000) each, followed by the note (0 <= note <= 10.0, with 1 decimal place).

Obs .: the notes will not be repeated. In other words, has no chance to have two students with the same note.

 

Output

 

You must print the student's registration number with the highest score or "Minimum note not reached" (without quotes) if no student has taken greater note than or equal to 8.

 

 

 

Input Sample Output Sample

3

1000 5

1001 10

1002 6

1001

 

4

900775 5.7

201553 7.9

5032 6.2

2088 2.1

Minimum note not reached

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include<stdio.h>

int main()
{   int n,i,a,c = 0,ind[1000],p;
    float gr[1000],b,max;

    scanf("%d",&n);

    for(i = 0;i  <  n; i++){
            scanf("%d %f",&a,&b);
                  ind[i] = a;
                  gr[i] = b;
                  if(gr[i] >= 8){
                    if(max < gr[i]){
                        max=gr[i];
                        p = i;
                        //printf("%.2f \t %.2f",max,gr[i]);
                    }
                    c=1;
                  }
    }
    if(c == 1){
      printf("%d\n",ind[p]);
    }
    else{
      printf("Minimum note not reached\n">;
    }

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 1000 5 1001 10 1002 6

Output

x
+
cmd
1001

#2 Code Example with C++ Programming

Code - C++ Programming


#include<stdio.h>
int main()
{
    int test;
    scanf("%d",&test);
    int code[test],i,final_value;
    double frac[test],val=0.0;
    for(i = 0; i  <  test; i++)
    {
        scanf("%d %lf",&code[i],&frac[i]);
    }
    for(i = 0; i  <  test; i++)
    {
        if(frac[i] > val)
        {
            val=frac[i];
            final_value=i;
        }
    }
    if(val<8)
        printf("Minimum note not reached\n");
    else
        printf("%d\n",code[final_value]>;
    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 1000 5 1001 10 1002 6

Output

x
+
cmd
1001

#3 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

const N = lines.shift();
let [a , b] = lines.shift().split(" ");
let tempMatricula;
let tempNota;
let i = 0;

while(i  <  N){
  if(i == 0){
    tempMatricula = a;
    tempNota = b;
    [a , b] = lines.shift().split(" ");
    i++;
  }
  else{
    if(parseFloat(tempNota) > parseFloat(b)){
      i++;
      [a , b] = lines.shift().split(" ");
    }
    else{
      tempMatricula = a;
      tempNota = b;
      i++;
      [a , b] = lines.shift().split(" ");
    }
  }
}


if(tempNota >= 8){
  console.log(tempMatricula);
}
else{
  console.log("Minimum note not reached");
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 1000 5 1001 10 1002 6

Output

x
+
cmd
1001

#4 Code Example with Python Programming

Code - Python Programming


n = int(input())
m = 0.0
al = 0
while(n > 0):
    n -= 1
    a, b = input().split()
    if float(b) > m:
        m = float(b)
        al = int(a)
        
if m >= 8:
    print(al)
else:
    print("Minimum note not reached")
Copy The Code & Try With Live Editor

Input

x
+
cmd
4 900775 5.7 201553 7.9 5032 6.2 2088 2.1

Output

x
+
cmd
Minimum note not reached
Advertisements

Demonstration


Previous
#2982 Beecrowd Online Judge Solution 2982 The Strike Stops or Continues? Solution in C, C++, Java, Js and Python
Next
#2987 Beecrowd Online Judge Solution 2987 Balloon of Honor Solution in C, C++, Java, Js and Python