Uri 1080 Solution || BEE 1080 || Beecrowd1080 Highest and Position

Beecrowd1080 Highest and Position question

Uri 1080 Solution || BEE 1080 ||Free Code Center

Highest and Position

Adapted by Neilor Tonin, URI  Brazil

Timelimit: 1

Read 100 integer numbers. Print the highest read value and the input position.

Input

The input file contains 100 distinct positive integer numbers.

Output

Print the highest number read and the input position of this value, according to the given example.

Input SampleOutput Sample
2
113
45
34565
6

8
 
34565
4
URI / BEECROWD Online Judge 1080 Solve  in C :  
#include <stdio.h>
 
int main() {
 
   int a,i,l=0,p=0;
   for(i=1;i<=100;i++){
       scanf("%d",&a);
       if(a>l){
         l=a; 
        p=i; 
       }
   }
   printf("%d\n",l);
   printf("%d\n",p);
 
    return 0;
}
URI / BEECROWD Online Judge 1080 Solve  in C++:  
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
   int a,i,l=0,p=0;
   for(i=1;i<=100;i++){
   cin>>a;
       if(a>l){
         l=a; 
        p=i; 
       }
   }
cout<<l<<endl;
cout<<p<<endl;
    return 0;
}

Previous Problem: Beecrowd 1178 Array Fill III Solution

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
NEW TOXIC ROCKET CYCLE DECK in Clash Royale 2023 Best Deck in Clash Royale Best Deck for Arena 8 in Clash Royale Best Hog deck for Pro players Best Clash Royale Deck