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.
uses crt;
var st,st1,st2:string;
i,d,dem,kt,j,x:integer;
a,b:array[1..255]of integer;
begin
clrscr;
write('Nhap chuoi:'); readln(st);
st1:='';
st2:='';
d:=length(st);
for i:=1 to d do
begin
if st[i] in ['0'..'9'] then st1:=st1+st[i]
else if (st[i] in ['a'..'z']) or (st[i] in ['A'..'Z']) then st2:=st2+st[i];
end;
for i:=1 to length(st1) do
val(st1[i],a[i],x);
b[1]:=a[1];
dem:=1;
for i:=1 to length(st1) do
begin
kt:=0;
for j:=1 to dem do
if a[i]=b[j] then kt:=1;
if kt=0 then
begin
inc(dem);
b[dem]:=a[i];
end;
end;
writeln('Cac so co trong day la: ');
for i:=1 to dem do
write(b[i]:4);
writeln;
writeln('Cac chu co trong day la:');
for i:=1 to length(st2) do
write(st2[i]:4);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
string st,a[1000];
int i,d,dem,j;
bool kt;
int main()
{
getline(cin,st);
d=st.length();
a[1]=st[0];
dem=1;
for (i=0; i<=d-1; i++)
{
kt=true;
for (j=1; j<=dem; j++)
if (a[j]==st[i]) kt=false;
if (kt==true)
{
dem++;
a[dem]=st[i];
}
}
for (i=1; i<=dem; i++) cout<<a[i]<<" ";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int d,i,d1;
string st;
int main()
{
getline(cin,st);
d=st.length();
while (st[0]==32)
{
st.erase(0,1);
}
while (st[d-1]==32)
{
st.erase(d-1,1);
}
d1=st.length();
for (i=0; i<d1; i++)
if ((st[i]==32) && st[i+1]==32)
{
st.erase(i,1);
i--;
}
cout<<st;
return 0;
}
#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;
}
1:
#include <bits/stdc++.h>
using namespace std;
long long n,i,dem,x;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x==0) dem++;
}
cout<<dem;
return 0;
}
Câu 2:
uses crt;
var a,b:array[1..100]of integer;
i,n,t,dem,j,kt,dem1:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
t:=0;
for i:=1 to n do t:=t+a[i];
writeln(t);
dem:=1;
b[1]:=a[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
begin
dem1:=0;
for j:=1 to n do
if a[j]=b[i] then inc(dem1);
writeln(b[i],' xuat hien ',dem1,' lan');
end;
readln;
end.
123456789MNBVCXZ