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='xsum1.inp';
fo='xsum1.out';
var f1,f2:text;
a:array[1..20000]of integer;
i,n,j,x,dem,k,m,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n,x);
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
for k:=1 to n do
if (i<j) and (j<k) then
begin
t:=0;
for m:=i to k do
t:=t+a[m];
if t=x then inc(dem);
end;
end;
for i:=1 to n do
if x=a[i] then inc(dem);
writeln(f2,dem);
close(f1);
close(f2);
end.
program COST;
var n,m,s,dem:int64;a:
array[1..1000000] of int64;
i,j:longint;
begin
readln(n,m);
for i := 1 to n do read(a[i]);
dem := 0;
for i := 1 to n do
begin
s := 0;
for j := i to n do
begin
s := s+a[j];
if s <= m then
begin
inc(dem);
continue;
end
else if a[j] > m then break;
end;
end;
write(dem);
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,j,dem;
bool kt;
int main()
{
freopen("dnto.inp","r",stdin);
freopen("dnto.out","w",stdout);
cin>>n;
for (i=2; i<=n; i++)
{
kt=true;
for (j=2; j*j<=i; j++)
if (i%j==0) kt=false;
if (kt==true) dem++;
}
cout<<dem;
return 0;
}
const fi='tong.inp';
fo='tong.out';
var f1,f2:text;
a:array[1..100]of integer;
n,i,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln(f2,t);
close(f1);
close(f2);
end.
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
freopen("ab.inp","r",stdin);
freopen("ab.out","w",stdout);
cin>>a>>b;
cout<<fixed<<setprecision(1)<<a+b<<endl;
cout<<fixed<<setprecision(1)<<a-b;
return 0;
}
program tim_nguon_nho_nhat;
const
MAX_NUMBER = 10000;
var
M, nguon_nho_nhat: Integer;
function TinhTongChuSo(num: Integer): Integer;
var
sumOfDigits: Integer;
begin
sumOfDigits := 0;
while num > 0 do
begin
sumOfDigits := sumOfDigits + (num mod 10);
num := num div 10;
end;
TinhTongChuSo := sumOfDigits;
end;
function TimNguonNhoNhat(M: Integer): Integer;
var
N, M_temp, M_digits, nguon_nho_nhat: Integer;
begin
M_temp := M;
nguon_nho_nhat := MAX_NUMBER;
for N := 1 to M_temp do
begin
M_digits := TinhTongChuSo(N) + N;
if M_digits = M_temp then
begin
if N < nguon_nho_nhat then
nguon_nho_nhat := N;
end;
end;
if nguon_nho_nhat = MAX_NUMBER then
TimNguonNhoNhat := 0
else
TimNguonNhoNhat := nguon_nho_nhat;
end;
begin
Readln(M);
nguon_nho_nhat := TimNguonNhoNhat(M);
if nguon_nho_nhat = 0 then
Writeln('0')
else
Writeln('Nguon nho nhat cua ', M, ' la ', nguon_nho_nhat);
end.
Bạn này mình cụng chưa giiaỉ được. bạn nào biết giúp đỡ