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.
const fi='daycontd.inp';
fo='daycontd.out';
var a:array[1..100]of integer;
n,i,dn,dem:integer;
f1,f2:text;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
{---------------------------xu-ly-------------------------}
dn:=0;
dem:=1;
for i:=1 to n-1 do
if a[i+1]>a[i] then
begin
inc(dem);
if i+1=n then
begin
if dn<dem then
begin
dn:=dem;
end
else if (dn=dem) then
begin
dn:=dem;
end;
end;
end
else if a[i+1]<a[i] then
begin
if dn<dem then
begin
dn:=dem;
end
else if (dn=dem) then
begin
dn:=dem;
end;
dem:=1;
end;
writeln(f2,'do dai cua doan dai nhat la: ',dn);
close(f1);
close(f2);
end.
Program hotrotinhoc_hoc24;
const fi='CAPSO.INP';
fo='CAPSO.OUT';
var a: array[1..100] of integer;
i,j,n,x,d: integer;
f: text;
procedure ip;
begin
assign(f,fi);
reset(f);
readln(f,n);
for i:=1 to n do read(f,a[i]);
readln(f);
read(f,x);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
d:=0;
for i:=1 to n do
for j:=i to n do
if i+j=x then inc(d);
write(f,d);
close(f);
end;
begin
ip;
out;
end.
N = int(input())
A = 0
B = 0
So_uoc = 0
KQ = ""
for x in range(1, N):
if (x%2==0) and (x%3==0):
A += 1
if (x>0) and (N%x==0):
if (x>B):
B = x
for i in range(1, N+1):
if (N%i==0):
So_uoc += 1
if (So_uoc == 2):
KQ = "YES"
else:
KQ = "NO"
print(A)
print(B)
print(len(str(N)))
print(KQ)
(Chẳng biết đúng không đâu )
uses crt;
var x:int64;
kt,i,n,d,j,kt1,k:integer;
a:array[1..100]of longint;
st:string;
ktnt:boolean;
begin
clrscr;
write('x='); readln(x);
if (0<x) and (x<1000000000) then
begin
kt:=0;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then kt:=1;
if kt=0 then
begin
str(x,st);
d:=length(st);
for j:=1 to d do
val(st[j],a[j],n);
ktnt:=false;
for j:=1 to d do
begin
kt1:=0;
for k:=2 to a[j]-1 do
if a[j] mod k=0 then kt1:=1;
if kt1=0 then ktnt:=true
else ktnt:=false;
end;
if ktnt=true then writeln(x*2)
else writeln(x div 2);
end
else writeln(x div 2);
end
else writeln('vui long nhap lai');
readln;
end.
uses crt;
const fi='dt.inp';
fo='dt.out';
var n,i,d,x,t,ln,kt:integer;
st:string;
a:array[1..100]of integer;
f1,f2:text;
begin
clrscr;
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
{-------------------------cau-a-----------------------}
str(n,st);
d:=length(st);
for i:=1 to d do
val(st[i],a[i],x);
t:=0;
for i:=1 to d do
begin
if a[i]=0 then t:=t+6;
if a[i]=1 then t:=t+2;
if a[i]=2 then t:=t+5;
if a[i]=3 then t:=t+5;
if a[i]=4 then t:=t+4;
if a[i]=5 then t:=t+5;
if a[i]=6 then t:=t+6;
if a[i]=7 then t:=t+3;
if a[i]=8 then t:=t+7;
if a[i]=9 then t:=t+6;
end;
writeln(f2,t);
{-----------------------cau-b---------------------------}
ln:=a[1];
for i:=1 to d do
if ln<a[i] then ln:=a[i];
writeln(f2,ln);
{--------------------cau-c-------------------------------}
kt:=0;
for i:=1 to d-1 do
if a[i]>a[i+1] then kt:=1;
if kt=0 then writeln(f2,'T')
else begin
kt:=0;
for i:=1 to d-1 do
if a[i]<a[i+1] then kt:=1;
if kt=0 then writeln(f2,'L')
else writeln(f2,'0');
end;
close(f1);
close(f2);
readln;
end.
#include <bits/stdc++.h>
using namespace std;
int n,c;
long long a[10000];
bool iscp(long long m){
return int(sqrt(m))*int(sqrt(m))==m;
}
int main()
{
cin>>n;
if(n==1){cout<<"0";return 0;}
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<n;i++){
for(int j=i+1;j<=n;j++){
if(a[i]<=a[j]&&iscp(a[i])&&iscp(a[j])){
c++;
}
}
}
cout<<c;
return 0;
}