Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
#include <bits/stdc++.h>
using namespace std;
long long a[250],ln,i,n;
int main()
{
cin>>n;
for (i=1;i<=n; i++) cin>>a[i];
ln=a[1];
for (i=1; i<=n; i++) ln=max(ln,a[i]);
cout<<ln<<endl;
for (i=1; i<=n; i++) if (ln==a[i]) cout<<i<<" ";
return 0;
}
uses crt;
var a,b,c:array[1..1000]of integer;
i,n,dem,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
for i:=1 to n do
if max=a[i] then
begin
inc(dem);
b[dem]:=a[i];
c[dem]:=i;
end;
if dem=1 then writeln('So lon nhat la: ',b[dem],' vi tri la: ',c[dem])
else writeln('So lon nhat la: ',b[1],' vi tri la: ',c[1]);
readln;
end.
uses crt;
var a:array[1..250]of integer;
i,n,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('Gia tri lon nhat la: ',max);
writeln('Vi tri cua no trong mang la: ');
for i:=1 to n do
if max=a[i] then write(i:4);
readln;
end.
program tim_so_nguyen_am;
uses crt;
var n,i:integer;
b:array[1..1000]of integer;
begin
clrscr;
write('nhap so phan tu :');readln(n);
repeat
for i:=1 to n do
begin
write('nhap phan tu b[',i,']:');readln(b[i]);
end;
if abs(a[i]>1000)then write('ban hay nhap lai:');
until abs(b[i]<=1000);
writeln('cac phan tu nguyen duong cua mang la:');
for i:=1 to n do
if b[i]>=0 then write(b[i]:5);
writeln;
writeln('cac phan tu nguyen am cua mang la:');
readln;
end.
for i:=1 to n do
if b[i]<0 then write(b[i]:5);
uses crt;
var b:array[1..25]of integer;
i,n,dem1,dem2:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('B[',i,']='); readln(b[i]);
end;
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if b[i]>0 then inc(dem1);
if b[i]<0 then inc(dem2);
end;
writeln('So cac so nguyen duong la: ',dem1);
writeln('So cac so nguyen am la: ',dem2);
readln;
end.
uses crt;
var a:array[1..250]of integer;
n,i,t,max,min:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 3=0 then t:=t+a[i];
writeln('Tong cac so la boi cua 3 la: ',t);
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
readln;
end.
program so_lon_nhat;
uses crt;
var a: array[1..100] of integer;
i,n,max,k,dem: integer;
s,tbc: real;
begin
clrscr;
writeln(' nhap so phan tu cua day'); readln(n);
for i:=1 to n do
begin
writeln('a[',i,']'); readln(a[i]);
end;
writeln(' nhap so can tim:'); readln(k);
max:=a[1];
i:=1;
dem:=0;
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
s:=s+a[i];
tbc:=s/n;
if a[i]=k then dem:=dem+1;
end;
writeln(' so lon nhat trong day tren la:',max);
while (i<n) and (a[i]<>k) do i:=i+1;
if a[i]=k then writeln(' phan tu thu ', i ,' bang ',k)
else writeln(' k tim dc phan tu',k);
writeln(tbc:6);
writeln('co', dem, ' phan tu', k);
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,ln,x;
int main()
{
cin>>n>>x;
ln=x;
for (i=1; i<n; i++)
{
cin>>x;
ln=max(ln,x);
}
cout<<ln;
return 0;
}
$#include <bits/stdc++.h>
using namespace std;
long long n,i,ln,x;
int main()
{
cin>>n>>x;
ln=x;
for (i=1; i<n; i++)
{
cin>>x;
ln=max(ln,x);
}
cout<<ln;
return 0;
}$
#include <bits/stdc++.h>
using namespace std;
long long a[1000],i,n,vt,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=1; i<=n; i++) nn=min(nn,a[i]);
vt=0;
for (i=1; i<=n; i++) if (min==a[i]) vt=i;
cout<<nn<<endl;
cout<<vt;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[10000],i,n,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
nn=a[1];
for (i=1; i<=n; i++) nn=min(nn,a[i]);
cout<<nn<<endl;
for (i=1; i<=n; i++) if (nn==a[i]) cout<<i<<" ";
return 0;
}
Ko hiểu:((((