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[150],i,s,n,nn;
int main()
{
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
s=1;
for (i=1; i<=n; i++)
if (a[i] %2!=0 && a[i]%3==0) s=s*a[i];
cout<<s<<endl;
nn=a[1];
for (i=1; i<=n; i++) nn=min(nn,a[i]);
for (i=n; i>=1; i--)
if (nn==a[i])
{
cout<<i<<endl;
break;
}
sort(a+1,a+n+1);
for (i=1; i<=n; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[40],i,n,ln;
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]);
for (i=n; i>=1; i--)
if (ln==a[i])
{
cout<<i;
break;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int a[1000000],n,b[1000000];
int main(){
cin >>n;
for (int i=1;i<=n;i++) {cin >> a[i];
if (a[i]%2==1) b[a[i]]=i;
}
for (int i=1;i<=n;i++){
if (b[a[i]]!=0) {cout << b[a[i]] << " "<<a[i]<<'\n';b[a[i]]=0;}
}
}
Nhập trực tiếp , in dạng :
Chỉ số _ số
......
uses crt;
var a,b,vt:array[1..100]of integer;
n,i,dem,j,kt,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
b[1]:=a[1];
dem:=1;
for i:=1 to n do
begin
kt:=0;
for j:=1 to dem do
if b[j]=a[i] then kt:=1;
if kt=0 then
begin
inc(dem);
b[dem]:=a[i];
end;
end;
for i:=1 to dem do
if b[i] mod 2<>0 then
begin
max:=0;
for j:=1 to n do
if b[i]=a[j] then
begin
if max<j then max:=j;
end;
writeln(b[i],' xuat hien o vi tri thu ',max);
end;
readln;
end.
uses crt;
var a:array[1..100]of integer;
i,n,t,min,vt: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 chia het cho 3 la: ',t);
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
vt:=1;
for i:=1 to n do
if min=a[i] then
begin
if vt<i then vt:=i;
end;
writeln('Gia tri nho nhat la: ',min);
writeln('Vi tri la: ',vt);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int A[500],n,i,dem,dem1;
int main()
{
cin>>n;
for (int i=1; i<=n; i++) cin>>A[i];
for (int i=n; i>=1; i--) cout<<A[i]<<" ";
cout<<endl;
dem=0;
for (int i=1; i<=n; i++)
if (A[i]<10) dem++;
cout<<dem<<endl;
dem1=0;
for (int i=1; i<=n; i++)
if (A[i]>1)
{
bool kt=true;
for (int j=2; j*j<=A[i]; j++)
if (A[i]%j==0) kt=false;
if (kt==true) dem1++;
}
cout<<dem1;
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 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,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;
}
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.
Bọn em học C++ ạ :<<