K
Khách

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='vanban.inp';

fo='vanban.out';

var f1,f2:text;

dem,i:integer;

a:array[1..1000]of string;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

dem:=0;

while not eof(f1) do 

begin

inc(dem);

readln(f1,a[dem]);

end;

writeln(f2,dem);

close(f1);

close(f2);

end.

#include <bits/stdc++.h>

using namespace std;

string st;

int d,i,dem;

int main()

{

freopen("xau.inp","r",stdin);

freopen("xau.out","w",stdout);

cin>>st;

d=st.length();

dem=0;

for (i=0; i<=d-1; i++)

if (st[i]=='a') dem++;

cout<<dem;

return 0;

}

const fi='dulieu.txt';

fo='ketqua.txt';

var f1,f2:text;

a,b:array[1..100]of integer;

n,i:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eof(f1) do

begin

n:=n+1;

readln(f1,a[n],b[n]);

end;

for i:=1 to n do 

begin

if (a[i]<b[i]) then writeln(f2,a[i])

else writeln(f2,b[i]);

end;

close(f1);

close(f2);

end.

#include <bits/stdc++.h>

using namespace std;

long long n,i,x;

//chuongtrinhcon

bool ktnt(long long x)

{

if (x<2) return false;

for (int i=2; i*i<=x; i++)

if (x%i==0) return(false);

return true;

}

//chuongtrinhchinh

int main()

{

freopen("dl.dat","r",stdin);

freopen("kq.dat","w",stdout);

cin>>n;

dem=0;

for (i=1; i<=n; i++)

{

cin>>x;

if (ktnt(x)) dem++;

}

cout<<dem;

return 0;

}

const fi='hinhtron.inp';

fo='hinhtron.out';

var f1,f2:text;

a:array[1..100]of real;

i,n:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eof(f1) do 

begin

n:=n+1;

read(f1,a[n]);

end;

for i:=1 to n do 

writeln(f2,'Hinh tron thu ',i,': Chu vi la ',(2*a[n]*pi):4:2,' va Dien tich la: ',a[n]*a[n]*pi:4:2);

close(f1);

close(f2);

end.

const fi='dl.dat';

fo='kq.dat';

var f1,f2:text;

a:array[1..100]of integer;

i,n,dem1,dem2,t1,t2: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]);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

t1:=0;

t2:=0;

for i:=1 to n do 

begin

if (a[i] mod 6=0) then t1:=t1+a[i];

if (a[i] mod 9=0) and (a[i] mod 2<>0) then t2:=t2+a[i];

end;

writeln(f2,dem1,' ',dem2);

writeln(f2,t1);

writeln(f2,t2);

close(f1);

close(f2);

end.

21 tháng 2 2022

const fi='dl.dat';

fo='kq.dat';

var f1,f2:text;

a:array[1..100]of integer;

i,n,dem1,dem2,t1,t2: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]);

dem1:=0;

dem2:=0;

for i:=1 to n do 

begin

if a[i] mod 2=0 then inc(dem1)

else inc(dem2);

end;

t1:=0;

t2:=0;

for i:=1 to n do 

begin

if (a[i] mod 6=0) then t1:=t1+a[i];

if (a[i] mod 9=0) and (a[i] mod 2<>0) then t2:=t2+a[i]

end

writeln(f2,dem1,' ',dem2)

writeln(f2,t1)

writeln(f2,t2)

close(f1)

close(f2)

;-;

const fi='xau.inp';

fo='xau.out';

var f1,f2:text;

a:array[1..100]of string;

i,d:integer;

begin

assign(f1,fi); reset(f1);

assign(f2,fo); rewrite(f2);

n:=0;

while not eof(f1) do 

  begin

n:=n+1;

readln(f1,a[n]);

end;

for i:=1 to n do 

  begin

for j:=1 to length(a[i]) do 

  a[i][j]:=upcase(a[i][j]);

end;

for i:=1 to n do 

  writeln(f2,length(a[i]),' ',a[i]);

close(f1);

close(f2);

end.