1樓:追月一族
1. var
a,b,i,m,n:longint;
t:text;
begin
a:=0;
b:=0;
readln(m);
for i:=1 to m do
begin
readln(n);
if n mod 2=0 then a:=a+n else b:=b+n;
end;
writeln(b);
writeln(a);
end.
2. var
a:array[1..10000] of boolean;
i,j,k,n,m:longint;
f:boolean;
t:text;
procedure oo;
vari,j,k:longint;
f:boolean;
begin
for i:=2 to 10000 do
begin
f:=false;
for j:=2 to trunc(sqrt(i)+1) doif i mod j=0 then
begin
f:=true;
break;
end;
if f=false then a[i]:=true;
end;
end;
begin
f:=false;
readln(n);
oo;for i:=1 to n do
begin
for j:=1 to n do
if (n-i-j>1)and(a[i]=true)and(a[j]=true) then
if a[n-i-j]=true then beginwriteln(i,' ',j,' ',n-i-j);
f:=true;
break;
end;
if f=true then break;
end;
end.
3. var
a:array[1..100,1..100] of integer;
max,i,j,k,n,m:longint;
t:text;
begin
readln(m,n);
for i:=1 to m do
begin
for j:=1 to n do
read(a[i,j]);
readln();
end;
for i:=1 to m do
begin
for j:=1 to n do
begin
read(k);
if k=a[i,j] then inc(max);
end;
readln();
end;
writeln(max);
end.
2樓:合笛南門娜娜
program
t;var
year,i,n:integer;
n1,n2,n3,n4,tpn,alln:longint;
begin
n1:=1;
n2:=0;
n3:=0;
n4:=0;
alln:=1;
n:=4;
readln(year);
fori:=2
toyear
dobegin
tpn:=n3;
n3:=n2;
n2:=n1;
n1:=n4+tpn;
n4:=n1;
alln:=n1+n2+n3+n4;
end;
writeln(alln);
end.
註釋1是顯示每年的各個階段牛數量,year年份,n1,n2
,n3,n4
出生第一年牛
,出生第二年牛
,出生第三年牛,第四年變母牛並生個小牛
註釋2按任意鍵結束。
pascal題目
3樓:匿名使用者
請問,lz有一些更復雜的測試資料嗎?
以下是一個簡短的**,執行一下看看對不對。
var a:array[1..300000]of longint;
s,n,i:longint;
begin
readln(n); s:=n;
for i:=1 to n do read(a[i]);
for i:=n downto 1 do
if a[i]=s then dec(s);
writeln(s);
end.
pascal題目
4樓:po家族
b前方有y-1列,每行80個字元,它是第y列從上往下數第x個,但左上角第一個字元位移為0,所以減一。最後乘二。
pascal題目求解
var n,i,j,k byte begin write n i j readln n,i,j if abs j n writeln n abs k n writeln for i 1 to n n 1 do begin for j 1 to n n 1 do begin if abs j n wr...
pascal題目答案
兩層for迴圈就可以了啊。program zl971013 var i,j,s,n integer begin s 0 read n for i 1 to n do for j 1 to i do s s j write s endl.program exam var i,j,s,n integer...
pascal數字圖形輸出,PASCAL數字圖形輸出
readln n k 0 i 0 j 0 while k n do begin inc i for j 1 to i do begin inc k write k if j i then write if k n then break end writeln if k n then break en...