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.
![](https://rs.olm.vn/images/avt/0.png?1311)
n = int(input("Nhập n: "))
a = [ ]
for i in range(n):
a.append(int(input(f"Nhập phần tử a[{i}]: ")))
print("Dãy số vừa nhập:")
# In dãy số theo thứ tự ngược lại
print(a[::-1])
if a == a[::-1]:
print("Dãy số là dãy đối xứng")
else:
print("Dãy số không phải là dãy đối xứng")
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <iostream>
#include <string>
using namespace std;
int main()
{
string st;
int dai,i,kt;
cout<<"Nhap chuoi:"; getline(cin,st);
dai=st.length();
kt=0;
for (int i=0;i<dai;i++)
if (st[i]!=st[dai-i-1]) kt=1;
if (kt==0) cout<<"YES";
else cout<<"NO";
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
Program HOC24;
var m,i,n: longint;
d1,d2,d3: integer;
function dx(x: longint): boolean;
var j: longint;
s,s1: string;
begin
s1:=''; dx:=false;
str(x,s);
for j:=length(s) downto 1 do
s1:=s1+s[j];
if s=s1 then dx:=true else exit;
end;
function cp(k: longint): boolean;
begin
cp:=false;
if k=sqr(trunc(sqrt(k))) then cp:=true else exit;
end;
begin
write('Nhap M; N: '); readln(m,n);
d1:=0; d2:=0; d3:=0;
if (m<n) and (m>=10) and (n<=100000) then
begin
write('Cac so doi xung la: ');
for i:=m to n do
if dx(i) then
begin
d1:=d1+1;
write(i,' ');
end;
writeln;
writeln('Co ',d1,' so doi xung');
write('Cac so chinh phuong la: ');
for i:=m to n do
if cp(i) then
begin
d2:=d2+1;
write(i,' ');
end;
writeln;
writeln('Co ',d2,' so chinh phuong');
write('Cac so doi xung chinh phuong la: ');
for i:=m to n do
if dx(i) and cp(i) then
begin
d3:=d3+1;
write(i,' ');
end;
writeln;
write('Co ',d3,' so doi xung chinh phuong');
end;
readln
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
#include <bits/stdc++.h>
using namespace std;
long long n,i;
bool kt;
int main()
{
cin>>n;
kt=true;
for (i=2; i*i<=n; i++)
if (n%i==0) kt=false;
if ((kt==true) and (n>1)) cout<<"YES";
else cout<<"NO";
return 0;
}
![](https://rs.olm.vn/images/avt/0.png?1311)
program superSymmetricalSubstring;
var
s: string;
function isSymmetrical(str: string): boolean;
var
i, len: integer;
begin
len := length(str);
for i := 1 to len div 2 do
begin
if str[i] <> str[len - i + 1] then
begin
exit(false);
end;
end;
exit(true);
end;
function countSuperSymmetricalSubstrings(s: string): integer;
var
i, j, len, count: integer;
begin
len := length(s);
count := 0;
for i := 1 to len do
begin
for j := 2 to len - i + 1 do
begin
if isSymmetrical(copy(s, i, j)) then
begin
count := count + 1;
end;
end;
end;
count := count + len;
exit(count);
end;
begin
write('Nhap xau S: ');
readln(s);
writeln('So xau con sieu doi xung cua S: ', countSuperSymmetricalSubstrings(s));
readln;
end.
![](https://rs.olm.vn/images/avt/0.png?1311)
program bai_10_chuong_4;
uses crt;
var
s: string[100];
i, dem: integer;
Begin
clrscr;
write('Nhap xau vao:'); readln(s); dem:= 0;
for i:= 1 to length(s) do
if ('0'<=s[i]) and(s[i]<=’9') then dem:=dem+l;
Writeln('Trong xau s co '»dem,' chu so thap phan');
readln;
End.
uses crt;
var st:string[100];
i,d,kt:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
kt:=0;
for i:=1 to length(st) do
if st[i]<>st[length(st)-i+1] then kt:=1;
if kt=0 then write('Xau doi xung')
else writeln('Xau khong doi xung');
readln;
end.
#include <bits/stdc++.h>
using namespace std;
string st;
int d,i;
bool kt;
int main()
{
getline(cin,st);
kt=true;
d=st.length();
for (i=0; i<=d-1; i++)
if (st[i]!=st[d-i-1]) kt=false;
if (kt==true) cout<<"YES";
else cout<<"NO";
return 0;
}