var
r,x,y:real
begin
readln(r){读入半径}
readln(x,y){读入坐标}
if sqr(x)+sqr(y)=sqr(r) then writeln('yes') {这个是圆心为原点配指的圆的标准方程}
else writeln('no')
end.
第二题
var
s,m,h,i:longint
a:array[1..100000] of longint
begin
readln(a[1]){读培辩配入a1,用数灶迹组读入}
readln(m,h){读入第m项和公差m}
s:=a[1]{用s记录从a1到第m项的乘积}
for i:=2 to m do
begin
a[i]:=a[i-1]+h{计算a[i]的值}
s:=s*a[i]{把a[i]乘到s中去}
end
writeln(s){输出从a1到am的积}
end.
1.输入三个数:A.B.C,输出其中最大和最小的数搏唤局,再输出2A.4B.3C中最大和最小基让的。函数:
program abc
var i:array[1..3] of longint
a,b,c,x:longint
function fun(var a1,b1,c1:longint):longint
var y:longint
begin
if a1>b1 then begin y:=a1a1:=b1b1:=yend
if a1>c1 then begin y:=a1a1:=c1c1:=yend
if b1>c1 then begin y:=b1b1:=c1c1:=yend
end
begin
readln(a,b,c)
i[1]:=a
i[2]:=b
i[3]:=c
x:=fun(a,b,c)
writeln(a,' ',c)
a:=i[1]
b:=i[2]
c:=i[3]
a:=a*2
b:=b*4
c:=c*3
x:=fun(a,b,c)
writeln(a,' ',c)
end.
过程:
program abc
var i:array[1..3] of longint
a,b,c:longint
procedure maxmin(min,max,y:longint)
begin
for min:=1 to 3-1 do
for max:=min to 3 do
if i[min]>i[max] then begin
y:=i[min]
i[min]:=i[max]
i[max]:=y
end
end
begin
read(a,b,c)
i[1]:=a
i[2]:=b
i[3]:=c
maxmin(i[1],i[2],i[3])
writeln(i[1],' ',i[3])
i[1]:=2*a
i[2]:=4*b
i[3]:=3*c
maxmin(i[1],i[2],i[3])
writeln(i[1],' ',i[3])
end.
2.用递归函数求n!
program JieCheng
var n:longint
s:real
function JC(t:real):real
begin
if t=0 then JC:=1
else JC:=t*JC(t-1)
end
begin
readln(n)
s:=JC(n)
writeln(n,'!=',s:10:10)
end.
3.自定义一个函数D(n)要求把正整数n中间的数链键取出,如果n为正整数则取中间的两位。
program su
var i:array[1..255] of longint
a,b,x:integer
str:string
begin
readln(str)
x:=length(str)
for a:=1 to x do
i[a]:=ord(str[x-a+1])-ord('0')
if x mod 2=0 then begin
b:=x div 2
write('(',str,')=',i[b+1],i[b])
end
else begin
b:=(x+1) div 2
write('(',str,')=',i[b])
end
writeln
end.
4.自定义一个函数把一个给定的十个数的最大和最小值求出。
这道题与第一题相同。
5.自定义一个函数判断输入的a.b是否互为质数。
program hzs
var i1,i2:longint
x:boolean
function hzsfun(k1,k2:longint):boolean
var f:longint
begin
if k1<k2 then begin
f:=k1
k1:=k2
k2:=f
end
if k1 mod k2<>0 then hzsfun:=true
end
begin
read(i1,i2)
x:=hzsfun(i1,i2)
if x=true then writeln('Yes')
else writeln('No')
end.
1:var a:array[1..1000] of longint
a1,a2:longint
begin
readln(a1){输入总数}
for a1:=1 to a1 do
begin
read(a2){输入每个数字}
inc(a[a2]){这个数字加一}
end
a2:=0{清零}
for a1:=1 to a1 do
if a[a1]>a2 then a2:=a[a1]{看哪个数出现的最多}
write(a2){输出}
end.
2.
var a1,a2,a3:longint
a:array[1..1000] of longint
function ass(a:longint):boolean {判断素数}
var a1:longint
begin
ass:=true
for a1:=2 to trunc(sqrt(a)) do
if a mod a1=0 then ass:=false
end
begin
readln(a1){输入总数}
for a1:=1 to a1 do
read(a[a1]){输入数组}
for a2:=1 to a1 do
for a3:=a2+1 to a1 do
if (ass(a[a2])) and (ass(a[a3])) and (ass((a[a2]+a[a3]) div 2)) and ((a[a2]+a[a3]) mod 2=0) then writeln(a[a2],' ',a[a3],' ',(a[a2]+a[a3]) div 2){判断}
end.
3.
var
a:array[1..10] of longint
a1,a2,a3,a4,a5,a6:longint
begin
for a1:=1 to 10 do read(a[a1]){输入}
for a1:=1 to 7 do
begin
a2:=a[a1]+a[a1+1]+a[a1+2]+a[a1+3]
if a3<a2 then begin a3:=a2a4:=a1end
if (a3>a5) or (a5=0) then begin a5:=a3a6:=a1end
end{判断知山哪一组数大}
writeln('大',a[a4],' ',a[a4+1],' ',a[a4+2],' ',a[a4+3],' ',a4,'~',a4+3)
writeln('小',a[a6].' ',a[a6+1],' ',a[a6+2],' ',a[a6+3],' ',a6,'搭升中~',a6+3)
{输出}
end.
4. {骗分(*^__^*) 嘻嘻……}
不要50,笑祥只要加赏~没事找我
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)