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 Sample | Output 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; }
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.