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.
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 )
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,t,dem,j;
int main()
{
cin>>n;
x=n;
t=0;
while (n>0)
{
t=t+n%10;
n=n/10;
}
cout<<t;
dem=0;
for (i=2; i<=x; i++)
{
bool kt=true;
for (j=2; j*j<=i; j++)
if (i%j==0) kt=false;
if (kt==true) dem++;
}
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i;
int main()
{
freopen("dayd.inp","r",stdin);
freopen("dayd.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]>0) cout<<a[i]<<" ";
return 0;
}
program tong_so_le;
var
n, i, a_i, tong: integer;
begin
writeln('Nhap vao so nguyen khong am n:');
readln(n);
while (n <= 0) or (n > 100) do
begin
writeln('So nguyen n phai thoa man 0 < n <= 100, vui long nhap lai:');
readln(n);
end;
writeln('Nhap vao ', n, ' so nguyen a1, a2, ..., an:','<mỗi số nguyên nhập trên một hàng>');
tong := 0; // Khởi tạo tổng bằng 0
for i := 1 to n do
begin
readln(a_i);
if i mod 2 = 1 then
tong := tong + a_i;
end;
writeln('Tong cac so tai vi tri le trong mang la: ', tong);
end.
const fi='divk.inp';
fo='divk.out';
var f1,f2:text;
a:array[1..100]of integer;
i,n,k,dem,j,x,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n,k);
for i:=1 to n do
read(f1,a[i]);
dem:=0;
for i:=1 to n do
for j:=1 to n do
begin
if i<j then
begin
t:=0;
for x:=i to j do
t:=t+a[x];
if t=k then inc(dem);
end;
for i:=1 to n do
if k=a[i] then inc(dem);
writeln(f2,dem);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
#define nhungcute ios_base::sync_with_stdio; cin.tie(0); cout.tie(0);
const int N=1500;
long long n,k,a[N],i,j,c[N][101];
int main(){
nhungcute
cin>>n>>k;
for(i=1;i<=n;i++)
cin>>a[i];
for(i=1;i<=n;i++){
a[i]=a[i]%k;
}
for(i=1;i<k;i++)
c[1][i] =-1e9;
c[1][a[0]]=0;
c[1][a[1]]=1;
for(i=2;i<=n;i++){
for(j=0;j<k;j++){
c[i][j]=max(c[i-1][j],c[i-1][(j-a[i]+k)%k]+1);
}
}
cout<<c[n][0];
return 0;
}
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.