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 i,n: integer;
a: array[1..1000] of integer;
t: longint;
f1,f2: text;
const fi='DATA1.TXT';
fo='KQ1.TXT';
begin
assign(f1,fi);
assign(f2,fo);
reset(f1);
rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
t:=0;
for i:=1 to n do if a[i] mod 2=0 then t:=t+a[i];
writeln(f2,t);
for i:=1 to n do if a[i] mod 5=0 then write(f2,a[i],' ');
close(f1); close(f2);
end.
uses crt;
const fi='dulieu.inp';
var f1:text;
a:array[1..100]of integer;
n,i,t1,t2:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then t1:=t1+a[i];
if a[i]<0 then t2:=t2+a[i];
end;
writeln('Tong cac so duong la: ',t1);
writeln('Tong cac so am la: ',t2);
close(f1);
readln;
end.
1:
#include <bits/stdc++.h>
using namespace std;
long long n,i,dem,x;
int main()
{
cin>>n;
dem=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x==0) dem++;
}
cout<<dem;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long long a[1000],n,i;
int main()
{
freopen("so.inp","r",stdin);
freopen("so.out","w",stdout);
cin>>n;
for (i=1; i<=n; i++) cin>>a[i];
for (i=1; i<=n; i++)
if (a[i]%2==0) cout<<a[i]<<" ";
return 0;
}
const fi='gameshow.inp';
fo='gameshow.out';
var f1,f2:text;
a,b:array[1..100]of integer;
n,i,tg,d,s,x,j,vtd,vt: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]);
{----------------------xu-ly------------------}
tg:=0;
for i:=1 to n do
tg:=tg+a[i];
for i:=n downto 1 do
if tg mod i=0 then
begin
d:=0;
s:=0;
x:=tg div i;
for j:=1 to n do
begin
s:=s+a[j];
if s=x then
begin
vt:=j;
inc(d);
b[d]:=vt;
s:=0;
end;
end;
if s=0 then
begin
b[d]:=n;
break;
end;
end;
writeln(f2,x);
writeln(f2,d);
for i:=1 to d do
write(f2,b[i],' ');
close(f1);
close(f2);
end.