1樓:聽不清啊
var a:array['0'..'1']of integer; c:char;
begin
while not (c='#') do
begin
read(c);
if c in ['0','1'] then inc(a[c]);
end;
writeln(a['0'],' ',a['1']);
end.
2樓:同冰昳
varch:char;
k,r:longint;
begin
read(ch);
k:=0; r:=0;
while ch<>'#' do beginif ch='1' then inc(k);
if ch='0' then inc(r);
read(ch);
end;
writeln(k,' ',r);
end.
不懂可追問哦。
3樓:匿名使用者
var num0,num1:integer;
ch:char;
num0:=0; num1:=0;
while(5>4)
begin
read(ch);
if (ch='#') break elseif (ch='1') num1:=num1+1 elseif (ch='0') num0:=num0+1;
end;
主要東西如上
4樓:廁所裡的草紙
varc:char;
a,b:longint;
begin
while c<> '#' do
begin
read(c);
if c='1'
then inc(a);
if c='0'
then inc(b);
end;
writeln(a,' ',b);
end.
一道Pascal題,pascal題目
vari,j,k integer beginfor i 1 to 5 dobeginfor j i downto 1 dowrite j for j 1 to 5 i do write 1 writeln end end 直接打的,可能會有細節上的錯誤。pascal題目 演算法分析 無論第i個瓶子塗什...
pascal程式設計題目
vara array 1.100 of integer n,i,ans,len,tmp,beg integer begin read n for i 1 to n do read a i tmp 0 ans 0 len 0 beg 0 for i 1 to n do begin if tmp a i...
pascal 數字分組問題,Pascal記數問題
答案是這些 計算這個答案的pascal程式如下,做好心理準備,別笑疼了肚子 program project1 var a1,a2,a3,a4,a5,a6,a7,a8,a9 integer beginfor a1 1 to 9 do for a2 1 to 9 do if a2 a1 then for...