发布网友 发布时间:2024-09-07 07:56
共4个回答
热心网友 时间:2024-09-09 00:18
额
小朋友
不要这样吧。。
对你学pascal 没好处的啊,
再说有些也能在百度上搜的到的丫
热心网友 时间:2024-09-09 00:18
1:
var
n,i:byte;
a,s:longint;
begin
readln(a,n);s:=0;
for i:=1 to n do begin
s:=s+a;
a:=a*10+a mod 10;
end;
writeln(s);
readln;
end.
2:
var
a,b,c:byte;
begin
for a:=1 to 9 do
for b:=0 to 9 do
for c:=0 to 9 do
if a*a*a+b*b*b+c*c*c=a*100+b*10+c then
writeln(a,b,c);
readln;
end.
3:
begin
write('Input the array:');
for i:=1 to 15 do read(a[i]);readln;
{paixu}
for i:=1 to 14 do for j:=i+1 to 15 do if a[i]>a[j] then begin
n:=a[i];a[i]:=a[j];a[j]:=n;
end;
{paixu}
write('Input the data:');
readln(n);
for i:=1 to 15 do if a[i]=n then break;
if a[i]=n then while a[i]=n do begin
write(i,' '); i:=i+1;
end else write('NO');
readln;
end.
4:
var
a:array [1..100,1..100] of integer;
i,j,k:byte;
x,y:byte;
f:boolean;
n:word;
begin
write('Input x, y:');
readln(x,y);
writeln('Input data:');
for j:=1 to y do for i:=1 to x do read(a[i,j]);readln;
n:=1;
for i:=1 to x do for j:=1 to y do begin
f:=true;
for k:=1 to x do if a[k,j]<a[i,j] then f:=false;
for k:=1 to y do if a[i,k]>a[i,j] then f:=false;
if f then begin writeln(n:3,' : ',i:3,', ',j:3); n:=n+1; end;
end;
if n=1 then writeln('Not found!');
readln;
end.
5:
var
a:longint;
i:byte;
function dc(n:longint):boolean;
var i:byte;
a:string;
begin
dc:=true;
str(n,a);
for i:=1 to length(a) do if a[i]<>a[length(a)+1-i] then dc:=false;
end;
begin
a:=95860;
while not dc(a) do inc(a);
write(a);
readln;
end.
6:
var
a:array [0..3000] of boolean;
i,j:word;
begin
fillchar(a,sizeof(a),true);
a[0]:=false; a[1]:=false;
for i:=2 to 3000 do if a[i] then
for j:=2 to 3000 div i do a[i*j]:=false;
for i:=11 to 3000 do if a[i] then
if not a[i mod round(exp(ln(10)*(trunc(ln(i)/ln(10)))))] then a[i]:=false;
for i:=1000 to 3000 do if a[i] then write(i:8);
readln;
end.
后面懒得写了,有空再说。
之前写过一个猜数字,放在这里了:
program gn;
type int_1_4=array [1..4] of integer;
st_5=string[5];
var i,j,k:integer;
numn,numg:int_1_4;
ga,gb:array [1..8] of integer;
nun:array [1..8,1..4] of integer;
flag:boolean;
ch:char;
procedure init;
var r_g:integer;
begin
randomize;
for i:=1 to 4 do begin
r_g:=random(10-i);
numn[i]:=r_g;
end;
for k:=1 to 4 do
for i:=1 to 4 do
for j:=1 to i-1 do
if numn[i]=numn[j] then begin
numn[i]:=succ(numn[i]);
numn[i]:=numn[i] mod 10
end;
flag:=false;
writeln;writeln;
end;
function readnum(var num:int_1_4):boolean;
var st5:st_5;
function realnum(numl:st_5):boolean;
var flagl:boolean;
begin
flagl:=true;
if length(numl)<>4 then flagl:=false;
realnum:=flagl;
if not flagl then writeln('ERROR:length');
if flagl then begin
for i:=1 to 4 do
if not (numl[i] in ['0'..'9']) then
flagl:=false;
if not flagl then begin
realnum:=false;
writeln('ERROR:char');
end;
if flagl then begin
热心网友 时间:2024-09-09 00:17
百度上搜
热心网友 时间:2024-09-09 00:22
额
小朋友
不要这样吧。。
对你学pascal 没好处的啊,
再说有些也能在百度上搜的到的丫!