Những câu hỏi liên quan
Tin Tin
Xem chi tiết
Nguyễn Lê Phước Thịnh
2 tháng 6 2020 lúc 18:58

const fi='diem.txt';
fo='kq.txt';
var f1,f2:text;
hs1,hs2,hs3:array[1..100]of integer;
dem1,dem2,dem3,t1,t2,t3,i,sc:integer;
kq:real;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
dem1:=0;
while not eoln(f1) do
begin
inc(dem1);
read(f1,hs1[dem1]);
end;
readln(f1);
dem2:=0;
while not eoln(f1) do
begin
inc(dem2);
read(f1,hs2[dem2]);
end;
readln(f1);
dem3:=0;
while not eoln(f1) do
begin
inc(dem3);
read(f1,hs3[dem3]);
end;
t1:=0;
for i:=1 to dem1 do
t1:=t1+hs1[i];
t2:=0;
for i:=1 to dem2 do
t2:=t2+(2*hs2[i]);
t3:=0;
for i:=1 to dem3 do
t3:=t3+(3*hs3[i]);
sc:=dem1+dem2*2+dem3*3;
kq:=(t1+t2+t3)/sc;
writeln(f2,kq:4:1);
close(f1);
close(f2);
end.

Bình luận (0)
Lê Thị Hồng Trang
Xem chi tiết
Nguyễn Lê Phước Thịnh
31 tháng 3 2022 lúc 22:46

uses crt;

const fi='so.inp'

var f1:text;

a,b:integer;

begin

clrscr;

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

while not eof(f1) do 

 begin

readln(f1,a,b);

writeln((a+b)/2:4:2);

end;

close(f1);

readln;

end.

Bình luận (0)
Duyvvv
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 5 2021 lúc 9:42

uses crt;

const fi='dulieu.txt'

var f1:text;

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

i,n:integer;

begin

clrscr;

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

n:=0;

while not eof(f1) do 

begin

inc(n);

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

end;

for i:=1 to n do 

begin

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

else writeln(b[i]);

end;

readln;

end.

Bình luận (0)
Yến Chi Phan Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 6:55

uses crt;

const fi='dulieu.dat'

var f1:text;

a,b,p,s:array[1..100]of real;

i,n:integer;

begin

clrscr;

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

n:=0;

while not eof(f1) do 

begin

n:=n+1;

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

end;

for i:=1 to n do 

  begin

p[i]:=(a[i]+b[i])/2;

s[i]:=a[i]*b[i];

end;

for i:=1 to n do 

  writeln(p[i]:4:2,' ',s[i]:4:2);

close(f1);

readln;

end.

Bình luận (0)
Trần Văn Tiến
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 2 2022 lúc 8:41

uses crt;

const fi='input.txt'

fo='output.txt'

var f1,f2:text;

a,b:integer;

begin

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

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

readln(f1,a,b);

if (a=0) and (b=0) then writeln(f2,'Phuong trinh co vo so nghiem');

if (a<>0) then writeln(f2,-b/a:4:2);

if (a=0) and (b<>0) then writeln(f2,'Phuong trinh vo nghiem');

close(f1);

close(f2);

end.

Bình luận (0)
33. PHAN THỊ HỒNG THẮM 1...
Xem chi tiết
Ngọc Hồng
Xem chi tiết
Nguyễn Lê Phước Thịnh
17 tháng 3 2022 lúc 14:48

#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;

}

Bình luận (0)
Lan Ngọc
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 1 2022 lúc 23:13

#include <bits/stdc++.h>

using namespace std;

long long a,b;

double tb;

int main()

{

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

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

cin>>a>>b;

cout<<a<<" "<<b;

cout<<fixed<<setprecision(2)<<(a*1.0+b*1.0)/(2*1.0);

return 0;

}

Bình luận (0)
U Lan
Xem chi tiết