过O作OE垂直AB,OF垂直CD 所以角OEP=角OFP,BE=AE=AB/2,CF=DF=CD/2 因为AB=CD 所以OE=OF,BE=DF 因为OP=OP 所以三角形OEP全等于三角形OFP 所以PE=PF 所以PB=PD 所以PA=PC
我以为多做就是最好的技巧,给你30道
1.请将以下程序段表示的计算公式写出来(假设X的值已给出)
E:=1; A:=1;
FOR N:=1 TO 10 DO
BEGIN
A:=AX/N;
E:=E+A;
ENDFOR;
写出所表示的公式。
2.阅读下列程序段,写出程序段运行后变量X的值。
100 X1=3
X1:=3;
X2:=8;
FOR I:=1 TO 5 DO
BEGIN 循环结构,应用数据轮换方式,求
X:=(X1+X2)2; 两个数和的2倍。
X1:=X2; X2:=X;
END;
WRITELN(‘X=’,X);
3.阅读下列程序段,写出程序运行后数组元素A1,A2,…,A11中的值。
A[1]:=1;
A[2]:=1; K:=1;
REPEAT
A[K+2]:=1;
FOR I:=K+1 DOWNTO 2 DO
A[I]:=A[I]+A[I-1];
K:=K+1;
UNTIL K>=10;
4. program exp1 (imput,output);
var i,s,max:integer;
a:array [110] of integer;
begin
for i:=1 to 10 do read(a[i]);
max:=a[1]; s:=a[1];
for i:=2 to 10 do
begin
if s<0 then s:=0;
s:=s+a[i];
if s>max then max:=s
end;
writeln(‘max=’,max)
end
输入:-2 13 -1 4 7 8 -1 -18 24 6
输出:max=
输入:8 9 -1 24 6 5 11 15 -28 9
输出:max=
5.program exp2 (input,output);
const n=5;
var i,j,k:integer;
a:array[12n, 12n] of integer;
begin
k:=1;
for i:=1 to 2n-1 do
if i<=n then
if odd(i) then for j:=i downto 1 do begin a[i-j+1,j]:=k; k:=k+1 end
else for j: =1 to i do begin a[i-j+1,j]:=k; k:=k+1; end
else if odd(i) then for j:=n downto i-n+1 do
begin a[i-j+1,j]:=k; k:=k+1; end
else for j:=i-n+1 to n do
begin a[i-j+1,j]:=k; k:=k+1; end;
for i:=1 to n do
begin
for j:=1 to n do write(a[i,j]:3);
writeln
end;
end
6.program exp3 (input,output);
const n=10;
var s,i:integer;
function co(i1:integer):integer;
var j1,s1:integer;
begin
s1:=n; for j1:=(n-1) downto (n-i1+1) do s1:=s1j1 div (n-j1+1);
co:=s1
end;
begin
s:=n+1; for i:=2 to n do s:=s+co(i);
writeln(‘s=’,s);
end
7.program exp4(input,output);
const n=3;
var i,j,s,x:integer;
p:array [0n+1] of integer;
g:array [0100] of integer;
begin
for i := 0 to 100 do g[i]:=0;
p[0]:=0; p[n+1]:=100; for i:= 1 to n do read (p[i]); readln;
for i:= 0 to n do
for j:= i+1 to n+1 do g[abs(p[j]-p[i])]:=g[abs(p[j]-p[i])]+1;
s:=0; for i:=0 to 100 do if g[i]>0 then begin write(i,:4); s:=s+1; end;
writeln; writeln(‘s=’,s); writeln(‘input data:’); readln(x);
writeln(g[x])
end
输入:10 20 65
input data: 10
输出:
8.program excpl;
var x,y,y1,jk,j1,g,e:integcr;
a:array [l20] of 09;
begin
x:=3465; y:=264; jk:=20; for j1:=1 to 20 do a[j1]:=0;
while y<>0 do
begin
y1:=y mod 10; y:=y div 10;
while y1<>0 do
begin
g:=x;
for e:=jk downto 1 do begin g:=g+a[e]; a[e]:=g mod 10; g:=g div 10 end;
y1:=y1-1
end;
jk:=jk-1
end;
j1:=1; while a[j1]=0 do j1:=j1+1;
for jk:=j1 to 20 do write(a[jk]:4); writeln
end
9.program excp2
var i,j:integer;
a:array [114] of integer;
procedure sw(i1,j1:integer);
var k1:integer;
begin
for k1:=1 to (j1-i1+1) div 2 do
begin
a[i1+k1-1]:=a[i1+k1-1]+a[j1-k1+1];
a[j1-k1+1]:=a[i1+k1-1]-a[j1-k1+1];
a[i1+k1-1]:=a[i1-k1+1]-a[j1-k1+1];
end;
end;
begin
j:=211; for i:=1 to 14 do begin a[i]:=i; j:=j-i end;
sw(1,4); sw( 5,10); sw(11,14); sw(1,14);
for i:=1 to 14 do begin if j mod i=1 then write (a[i]:3); j:=j-a[i]; end;
writeln
end
10.program noi_002;
var i,j,l,n,k,s,t:integer;
b:array [110] of 09;
begin
readln(l,n); s:=l; k:=1; t:=l;
while s<n do begin k:=k+1; t:=tl; s:=s+t end;
s:=s-t; n:=n-s-1; for i:=1 to 10 do b[i]:=0;
j:=11; while n>0 do begin j:=j-1; b[j]:=n mod l; n:=n div l end;
for i:=10-k+1 to 10 do write(chr(ord('a')+b[i]));
end
输入:4 167
输出:
11.program noi_004;
var i,j,j1,j2,p,q:integer;
p1:boolean;
b,c:array [1100] of integer;
begin
readln(q,p); j:=1; p1:=true; b[j]:=q; j1:=0;
while (q>0) and p1 do
begin
j1:=j1+1; c[j1]:=q10 div p; q:=q10-c[j1]p;
if q>0 then begin
j2:=1; while (b[j2]<>q) and (j2<=j) do j2:=j2+1;
if b[j2]=q
then begin
p1:=false; write('0');
for i:=1 to j2-1 do write(c[i]:1);
write('{');
for i:=j2 to j1 do write(c[i]:1);
writeln('}')
end
else begin j:=j+1; b[j]:=q end
end
end;
if q=0 then begin
write('0');
for i:=1 to j1 do write(c[i]:1);
writeln
end;
readln
end
输入 ① 1 8 输出
输入 ② 2 7 输出
12 program chu7_1;
function fun(x:integer):integer;
begin
if (x=0) or (x=1) then fun:=3
else fun:=x-fun(x-2)
end;
begin
writeln(fun(9));
readln;
end
13program chu7_2;
var i,j,f:integer;
a:array [18] of integer;
begin
for i:=1 to 8 do
begin
f:=i mod 2;
if f=0 then a[i]:=0
else a[i]:=1;
for j:=1 to i do
if f=0 then a[i]:=a[i]+j
else a[i]:=a[i]j
end;
for i:=1 to 8 do write(a[i]:5);
end
14program chu7_3;
var p,q,s,t:integer;
begin
readln(p);
for q:=p+1 to 2p do
begin
t:=0; s:=(pq)mod(q-p);
if s=0 then begin t:=p+q+(pq)div(q-p); write(t:4); end;
end;
readln
end
输入:12
输出:
15prgoram chu7_4;
var n,k,i:integer;
a:array [140] of integer;
procedure find(x:integer);
var s,i1,j1:integer;
p:boolean;
begin
i1:=0; p:=true;
while p do
begin
i1:=i1+1; s:=0;
for j1:=1 to n do if a[j1]>a[i1]then s:=s+1;
if(s=x-1)then begin writeln(a[i1]); p:=false end;
end
end;
begin
readln(n,k);
for i:=1 to n do read(a[i]);
find(k); find(n-k);
end
输入:10 4
12 34 5 65 67 87 7 90 120 13
输出:
16program exp1;
var i,j,k,n,,l0,l1,lk:integer;
a:array [020] of integer;
begin
readln(n,k);
for i:=0 to n-1 do a[i]:=i+1;
a[n]:=a[n-1]; l0:=n-1; lk:=n-1;
for i:=1 to n-1 do
begin
l1:=l0-k; if (l1<0) then l1:=l1+n;
if (l1=lk) then begin a[l0]:=a[n]; lk:=lk-1; a[n]:=a[lk]; l0:=lk end;
else begin a[l0]:=a[l1];l0:=l1; end;
end;
a[l0]:=a[n]; for i:=0 to n-1 do write(a[i]:40); writeln;
end
输入:10 4
输出:
17program exp2;
var n,jr,jw,jb:integer;
ch1:char;
ch:array [120] of char;
begin
readln(n); for i:=1 to n do read(ch[i]); jr:=1; jw:=n; jb:=n;:
while (jr<=jw) do
begin
if (ch[jw]='R')
then begin
ch1:=ch[jr]; ch[jr]:=ch[jw]; ch[jw]:=ch1; jr:=jr+13
end
else if ch[jw]='W' then jw:=jw-1
else begin
ch1:=ch[jw];ch[jw]:=ch[jb];ch[jb]:=ch1;
jw:=jw-1;jb:=jb-1;
end
end;
for i:=1 to n do write(ch[i]);
writeln;
end
输入:10
RBRBWWRBBR
输出:
18pmgram exp3;
var i,j,p,n,q,s:integer;
a:array [120] of integer;
begin
readln(p,n,q);j :=21;
while (n>0)do begin j:=j-1;a[j]:=n mod 10;n:=n div 10; end;
s:=0; for i:=j t0 20 do s:=sp+a[i]; writeln(s); j:=21;
while (s>o)do begin j:=j-1; a[j]:=s mod q; s:=s div q; end;
for i:=j to 20 do write(a[i]);readln;
end
输入:7 3051 8
输出:
19.program programl;
var a,x,y,okl,ok2:integer;
begin
a:=100; x:=l0; y:=20; okl:=5; ok2:=0;
if ((x>y) or ((y<>20) and (okl=0)) and (ok2<>0)) then a:=1
else if ((okl<>0) and (ok2=、0)) then a:=-1 else a:=0;
writeln(a);
end.
20.program Program2;
var a,t:string;
i,j:integer;
begin
a:=morning; j:=l; for i:=2 to 7 do if (a[j]<a[i]) then j:=i;
j:=j-1; for i:=1 to j do write(a[i]);
end.
21.program program3;
var a,b,c,d,sum:longint;
begin
read (a,b,c,d);
a:=a mod 23; b:=b mod 28; c:=c mod 33; sum:=a5544+b 14421+c1288-d;
sum:=sum+21252; sum:=sum mod 21252; if (sum=0) then sum:=21252;
writeln(sum);
end.
输入:283 102 23 320
输出:
22.program program4;
var a:array [05] of integer;
sum,n,max,i,j,k:integer;
cover:array [022000] of Boolean;
begin
read(a[5],a[4],a[3],a[2],a[1],a[0]);
if ((a[5]=0) and (a[3]=0) and (a[1]=0))
then begin a[5]:=a[4]; a[4]:=a[2]; a[3]:=a[0]; a[2]:=0; a[0]:=0; end;
for i:=0 to 5 do if (a[i]>10) then a[i]:=10+(a[i] mod 2);
sum:=0;
for i:=0 to 5 do sum:=sum+a[i](6-i);
if ((sum mod 2)<>0) then begin writeln(‘Can’t be divided’); exit; end;
sum:=sum div 2; max:=0; cover[0]:=True;
for i:=1 to sum2 do cover[i]:=False;
for i:=0 to 5 do;
begin
j:=0;
while (j<a[i]) do
begin
for k:=max downto 0 do
begin if (cover[k]) then cover[k+6-i]:=True; end;
max:=max+6-I; j:=j+1;
end;
end;
if (cover[sum]) then writeln(‘Can be divided’)
else writeln(‘can’t be divided’);
end.
输入:4 7 9 20 56 48 输入:1000 7 101 20 55 1 输入:2000 5 l 1 0 0
输出: 输出: 输出:
23.program program1;
var
a,b,c,d,e:integer;
begin
a:=79; b:=34; c:=57; d:=0; e:=-1;
if (a<c) or (b>c) then d:=d+e
else if (d+10<e) then d:=e+10
else d:=e-a;
writeln(d);
end
24.program program2;
var
i,j:integer;
str1,str2:string;
begin
str1:='pig-is-stupid'; str2:='clever';
str1[1]:='d'; str1[2]:='o'; i:=8;
for j:=1 to 6 do begin str1[i]:=str2[j]; inc(i); end;
writeln(str1);
end
25.program progam3;
var u:array [03] of integer;
a,b,c,x,y,z:integer;
begin
read(u[0], u[1], u[2], u[3]); a:=u[0]+u[1]+u[2]+u[3]-5;
b:=u[0](u[1]-u[2] div u[3]+8); c:=u[0]u[1] div u[2]u[3];
x:=(a+b+2)3-u[(c+3) mod 4]; y:= (c100-13) div a div (u[b mod 3]5);
if((x+y) mod 2=0) then z:=(a+b+c+x+y) div 2;
z:=(a+b+c–x-y)2; writeln(x+y-z);
end
输入:2 5 7 4
输出: 。
26.program program4;
var c:array [13] of string[200];
s:array [110] of integer;
m,n,i:integer;
procedure numara;
var cod:boolean;
i,j,nr:integer;
begin
for j:=1 to n do begin
nr:=0; cod:=true;
for i:=1 to m do
if c[i,j]='1'
then begin if not cod
then begin cod:=true; inc(s[nr]); nr:=0; end
end
else begin
if cod then begin nr:=1; cod:=false; end
else inc(nr);
end;
if not cod then inc(s[nr]);
end;
end;
begin
readln(m, n); for i:=1 to m do readln(c[i]);
numara; for i:=1 to m do if s[i]<>0 then write(i,' ',s[i],' ');
end
输入:3 10
1110000111
1100001111
1000000011
输出: 。
27.program cup_1;
var n,i,j,k,di,dj:integer;
a:array [120,120] of integer;
begin
n:=7;i:=1;j:=n;k:=1;di:=1;dj:=1;
while (k<=nn) do
begin
a[i,j]:=k; k:=k+1;i:=i+di;j:=j+dj;
if (i=n+1)
then begin i:=n;j:=j-2;di:=-1;dj:=-1 end
else if (j=n+1)
then begin j:=n;di:=-1;dj:=-1 end
else if (j=0)
then begin i:=i+2;j:=1;di:=1;dj:=1 end
else if (i=0) begin j:=1;di:=1;dj:=1 end
end;
for j:=1 to n do write(a[n div 2,j]:4);
writeln
end
28.program cup_2;
var s:string;i,j,m,w:integer;c:char;
a:array [0127] of integer;
begin
for i:=0 to 127 do
begin
c:=chr(i);
if ((’0’<=c) and (c<=’9’))
then a[i]:=1
else
if (((’A’<=c) and (c<=’Z’)) or ((’a’<=c) and (c<=’z’)))
then a[i]:=2
else a[i]:=0
end;
readln(s); m:=length(s);
for i:=1 to m do
begin
j:=ord(s[i]);
if (a[j]>0) then begin write(s[i]);a[j]:=a[j]-1 end
end;
writeln
end
输入:123+1234a+12abc-aaABBABC
输出:
29.program cup_3;
function f(m,n,k:integer):integer;
begin
if ((m=0) and (n=0) and (k=0))
then f:=1
else if ((0<=m) and (m<=n) and (n<=k))
then f:=f(m-1,n,k)+f(m,n-1,k)+f(m,n,k-1)
else f:=0;
end;
begin
writeln(f(3,3,3));
end
30.program cup_4;
var s:string;wc,lcs,i:integer
begin
readln(s);wc:=0;lcs:=1;
for i:=1 to length(s) do
if ((lcs=0) and ((s[i]=’’) or (s[i]=chr(9))))
then lcs:=1
else if ((lcs=0) and (s[i]<>’’) and (s[i]<>chr(9)))
then begin wc:=wc+1;lcs:=0 end;
writeln(wc);
end
输入:This is a test program!
输出:
7 有以下程序
#include <stdioh>
#include <stringh>
main( )
{ char p[20]={‘a’,’b’,’c’,’d’},q[]=”abc”,r[ ]=”abcde”;
strcpy(p+strlen(q),r);
strcat(p,q);
printf(“%d %d\n”,sizeof(p),strlen(p));
}
程序运行后的输出结果是( C )。
A)20 9 B) 9 9 C) 20 11 D)11 11
详细解释不懂得不要瞎答
修改后的代码:
#include <stdioh>void Print(char arr, int len); //arr改成arr
void main()
{
char pArray[] = {"Fred","Barrey","Wilma","Betty"};
int num = sizeof(pArray) / sizeof(char);
printf("Total string numbers = %d\n", num);
Print(pArray, num);
}
void Print(char arr, int len) //arr改成arr
{
for (int i=0; i<len; i++)
{
printf("%s\n", arr[i]);//arr[i]改成arr[i]
}
}
结果是:3 1
p就是一个包含了三个字符的字符数组,元素个数就是3,;
q是一个字符串数组,编译系统会在字符串尾端自动加上'\0'字符作为结束符,所以,sizeof(q)应该是4, 而q则是字符数组的首地址,代表第一个字符的长度,就是1
以上就是关于如图,在圆O中,AB=CD,AB、CD的延长线相交于点P,求证:PA=PC全部的内容,包括:如图,在圆O中,AB=CD,AB、CD的延长线相交于点P,求证:PA=PC、NOIP读程序的技巧(Pascal)、#include <string.h> #include <stdio.h> main() { char p[20]={'a','b','c','d'},q[]="abc",r[]="abcde";等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)