1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int n; int a,s=10005,sk; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a; if(a<s){s=a;sk=i;} } cout<<s<<" "<<sk<<endl; return 0; }Pascal :
var i,n,s,p:integer; a:array[1..1000] of integer; begin readln(n); for i:=1 to n do read(a[i]); s:=a[1];p:=1; for i:=1 to n do if a[i] < s then begin s:=a[i];p:=i; end; write(s,' ',p); end.
- 1
Information
- ID
- 16417
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By