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.
a: #include <bits/stdc++.h>
using namespace std;
unsigned long long int n,i,t1,t2,x;
int main()
{
cin>>n;
t1=0;
t2=0;
for (i=1; i<=n; i++)
{
cin>>x;
if (x%2==0) t1=t1+x;
else t2=t2+x;
}
cout<<t1<<endl;
cout<<t2;
return 0;
}
var a:array[1..1000] of integer;
i,n,d,max:integer;
begin
write('n = ');readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' = ');readln(a[i]);
if a[i] mod 2 <> 0 then d:=d+1;
end;
max:=a[1];
for i:=2 to n do
if a[i] > max then max:=a[i];
writeln('Co ',d,' so le');
write('So lon nhat la ',max);
readln
end.
uses crt;
var n,i,chan,tonchan:integer;
a:array[1..100] of integer;
begin
write('nhap n '); readln(n);
for i:=1 to n do
begin
write('a[i]='); readln(a[i]);
end;
writeln("in cac phan tu trong mang");
for i:=1 to n do
begin
writeln(a[i]);
end;
writeln("in cac phan tu chan");
chan:=0;
for i:=1 to n do
if n mod 2=0 then begin writeln(a[i]); chan:=chan+1; end;
write('tong cac phan tu chan ',chan);
readln;
end.
program hotrotinhoc;
var a,b: array[1..8000] of integer;
c,d1: array[1..8000] of ansistring;
j,i,d,d2,n: integer;
t,t1,tg,tg1,st,s: ansistring;
begin
write('n='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
write('b[',i,']='); readln(b[i]);
end;
for i:=1 to n do if a[i] mod 2 =0 then
begin
str(a[i],t);
s:=s+t;
end
else
begin
str(a[i],t1);
st:=st+t1;
end;
for i:=1 to n do if b[i] mod 2=0 then
begin
str(b[i],t);
s:=s+t;
end
else
begin
str(b[i],t1);
st:=st+t1;
end;
d:=0;
for i:=1 to length(s) do
begin
inc(d);
c[d]:=s[i];
end;
for i:=1 to d do for j:=i to d do
if c[i]>c[j] then
begin
tg:=c[i];
c[i]:=c[j];
c[j]:=tg;
end;
for i:=1 to d do write(c[i],' ');
d2:=0;
for i:=1 to length(st) do
begin
inc(d2);
d1[d2]:=st[i];
end;
for i:=1 to d2 do
for j:=i to d2 do
if d1[i]<d1[j] then
begin
tg1:=d1[i];
d1[i]:=d1[j];
d1[j]:=tg1;
end;
for i:=1 to d2 do write(d1[i],' ');
readln
end.
#include <bits/stdc++.h>
using namespace std;
long long n,i,x,dem,a;
int main()
{
cin>>n>>x;
dem=0;
for (i=1; i<=n; i++)
{
cin>>a;
if (a==x) dem++;
}
cout<<dem;
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.