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.
Program HOC24;
var n,i: integer;
t: longint;
Begin
write('Nhap N: '); readln(N);
t:=0;
for i:=1 to n do t:=t+i;
if t mod 2=0 then write('Tong la so chan') else write('Tong la so le');
readln
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;
var a:array[1..100]of integer;
i,n:integer;
begin
clrscr;
readln(n);
for i:=1 to n do
readln(a[i]);
for i:=1 to n do
write(a[i]:4);
writeln;
for i:=1 to n do
if (a[i]+a[i+1] mod 10=0) then
begin
writeln(a[i],' ',a[i+1]);
writeln(i,' ',i+1);
end;
readln;
end.
#include <bits/stdc++.h>
using namespace std;
long long n;
//chuongtrinhcon
int tongchuso(long long n)
{
int t=0;
while (n>0)
{
int x=n%10;
t=t+x;
n=n/10;
}
return(t);
}
//chuongtrinhchinh
int main()
{
freopen("sonut.inp","r",stdin);
freopen("sonut.out","w",stdout);
cin>>n;
int t=tongchuso(n);
while (t>10)
{
t=tongchuso(t);
}
cout<<t;
return 0;
}
uses crt;
var x,n,d,i:longint;
st,st1:string;
a:integer;
{----------------------chuong-trinh-con-tim-ucln---------------------}
function ucln(a,b:longint):longint;
var t:longint;
begin
t:=b mod a;
while t<>0 do
begin
t:=a mod b;
a:=b;
b:=t;
end;
ucln := a;
end;
{-------------------chuong-trinh-chinh-----------------}
begin
clrscr;
write('nhap x='); readln(x);
str(x,st);
d:=length(st);
st1:='';
for i:=d downto 1 do
st1:=st1+st[i];
val(st1,n,a);
if ucln(x,n)=1 then writeln('Phai')
else writeln('khong phai');
readln;
end.