程序
流程图及程序
北洋无终子FORTRAN90基础练习 1.输入圆的半径r,求圆周长l、圆面积s。 3.现有人口13亿,如果每年增长率r=0.8%,求多
n,少年后人口超过26亿(根据公式26,13(1,r)
输入r
log(2)n,推导出年数n可以用公式计算)。 s=PI*r*r log(1,r)
l=2*PI*r
输入增长率r
输出s,l
log(2) n,program lb 可以不写 log(1,r)
real r,s,l
parameter (PI=3.1415926) 输出n
write (*,*) "请输入圆的半径r"
read (*,*) r
program lb s=PI*r*r
real::r,n,a=2 如此定义时::必带 l=2*PI*r
write (*,*) "请输入增长率r" write (*,*) "此圆面积=",s,"此圆周长=",l
read (*,*) r end
n=log10(a)/log10(1+r)
print *,n
end 2.半径r和高h,球
面积、球体积和圆柱体积。
注意:要定义a=2,why?浮点问题,2.0可以 输入r,h
s=4*PI*r*r 4(输入平面坐标系中两个点的坐标和(x,y)11
v1=4*PI*r**3/3
,计算两点之间的距离。 (x,y)22v2=PI*r*r*h
x,yx,y输入, 1122输出s,v1,v2
program lb xxyyd=sqrt((-)**2+(-)**2) 2112 real r,h,s,v1,v2
parameter (PI=3.1415926) 输出d write (*,*) "请输入半径r,高h"
read (*,*) r,h program lb
s=4*PI*r*r real::x1,y1,x2,y2,d
v1=4*PI*r**3/3 v1=4/3*PI*r**3 不对 write (*,*) "输入两点坐标(x1,y1),(x2,y2)"
v2=PI*r*r*h read *,x1,y1,x2,y2
write (*,*) "球的表面积=",s,"球的体积 d=SQRT((y1-y2)**2+(x1-x2)**2)
=",v1,"圆柱的体积=",v2 print*,"两点间距离=",d end end
- 1 -
北洋无终子FORTRAN90基础练习 5(输入华氏温度值F,求出摄氏温度C,其公式为:AX,BY,C,11157. 求解二元一次方程组的解 ,。 AXBYC,,C,(F,32)222,
9
输入、、、、和 ABCABC输入F 111222
5
C,(F,32)x=(c1*b2-c2*b1)/(a1*b2-b1*a2)
9
输出C y=(c2*a1-c1*a2)/(a1*b2-b1*a2)
a1*b2— b1*a2/=0
Y N program lb
real f,c 输出x,y “无意义” write (*,*) "请输入华氏温度f"
read (*,*) f
c=5*(f-32)/9 c=5/9*(f-32) 注:不对program lb
print *,"摄氏温度=",c real a1,b1,c1,a2,b2,c2
end write (*,*) "请输入a1,b1,c1,a2,b2,c2"
read (*,*) a1,b1,c1,a2,b2,c2
x=(c1*b2-c2*b1)/(a1*b2-b1*a2)
y=(c2*a1-c1*a2)/(a1*b2-b1*a2)
if (a1*b2-b1*a2/=0) then 6.使用Print语句输出以下图形。 print *,x,y
* * * * * * * * * else
* * * * * * * * * print *,"无意义"
* * * * * * * * * end if
* * * * * * * * * end
* * * * * * * * *
program lb
print *," *********"
print *," *********"
print *," *********"
print *," *********"
print *,"*********"
end
- 2 -
北洋无终子FORTRAN90基础练习 8.输入三条边a,b,c,求三角形的面积。 program lb
real h,f,x,y 输入a,b,c write (*,*) "请输入鸡、兔的头和脚数h,f"
read (*,*) h,f a+b>c并且 ,a-b,
=0.and.x==INT(x).and.y>=0.and. y&
&==INT(y)) then
输出s write (*,*) "有鸡:",x,"有兔:",y
else program lb
print *,"数据有误" real a,b,c,p,s
end if write (*,*) "请输入三条边a,b,c"
end read (*,*) a,b,c
if (a+b>c.and.ABS(a-b)= 0的整数,
Y N
输出x,y :数据有误:
- 3 -
北洋无终子FORTRAN90基础练习 1. 输入a、b值,输出其中较大的数。 2(输入a、b,若a>b,则交换a和b,使得a?b。
输入a,b 输入a,b
a> b ? a>b ?
Y Y N
N
输出a 输出b
t=a
program lb
real a,b a=b
write (*,*)"请输入任意数a,b"
b=t read (*,*) a,b
if (a>b) then 输出a,b write (*,*) "较大数为:",a program lb else real a,b,t write (*,*) "较大数为:",b write (*,*) "请输入任意数a,b" end if read (*,*) a,b end if (a>b) then t=a a=b 1.1 program lb b=t real x,y,,z,MAX write (*,*) a,b write (*,*)"请输入任意数x,y,z" else read *,x,y,z write (*,*) a,b MAX=x end if if (MAXb ?
print*,'input three numbers:' Y N
read*,a,b,c a,b交换 if (a>b) call swap(a,b)
if (a>c) call swap(a,c) a>c ?
if (b>c) call swap(b,c) Y N
print*,'the result:',a,b,c a,c交换 end
subroutine swap(x,y) b>c ?
implicit none Y N
integer x,y,t
b,c交换 t=x
x=y
输出a,b,c y=t
end subroutine program lb
real a,b,c,i,j,k
write (*,*) "请输入a,b,c"
read (*,*) a,b,c
if (a>b) then
i=a
a=b
b=i
end if
if (a>c) then
j=a
a=c
c=j
end if
if (b>c) then
k=b
b=c
c=k
end if
write (*,*) a,b,c
end
- 5 -
北洋无终子FORTRAN90基础练习
4.输入四个变量a,b,c,d,从大到小排序。 program lb
real a,b,c,d,i,j,k,l,m,n 输入a,b,c,d write (*,*) "请输入任意数a,b,c,d"
read (*,*) a,b,c,d a=90
PRINT*,"中" rk N
CASE(80:89) Y
PRINT*,"良" ma>=80
CASE(90:100) rk N
PRINT*,"优秀" Y
CASE DEFAULT ma>=70
PRINT*,"成绩输入错误" rk N
END SELECT Y 优秀
END ma>=60 良 rk N xx,1,,Y 中 6(输入x,求函数值。 fxxx(),2,11,,10,2,xxx,2,2,10,及格 不及格
输入x program lb
x <1 real mark
Y N write (*,*) "请输入学生课程成绩mark"
x <10 read (*,*) mark
y N if (mark.ge.90) then y=x
write (*,*) "优秀" y=2x-1 y=x*x+2x+2
else if (mark.ge.80) then 输出y write (*,*) "良"
program lb else if (mark.ge.70) then
real x,y write (*,*) "中"
write (*,*) "请输入x" else if (mark.ge.60) then
read (*,*) x write (*,*) "及格"
if (x<1) then else
y=x write (*,*) "不及格"
else if (x<10) then end if
y=2*x-1 end
else
y=x*x+2*x+2
end if
write (*,*) "y=",y
end
- 7 -
北洋无终子FORTRAN90基础练习
2x,1x,0,8.输入a和b的值,按公式,2x,100,x,10,lna,lnba,0,b,0,7(输入x,求的值。 f(x),,2x,10010,x,100,,y,sina,sinba,0,b,0计算y值。 ,2,xx,100,,sina,cosba,0,
输入x
输入a,b x <0
Y N a >0
N Y x <10
Y N b >0
N Y x <100 y=sina+cosb y=2*x-1 Y N y=sina+sinb y=lna+lnb y=2x+10
y=2x+100 y=x*x
输出y 输出y
program lb program lb
real a,b,y real x,y
write (*,*) "请输入a,b" write (*,*) "请输入x"
read (*,*) a,b read *,x
if (a>0) then if (x<0) then
if (b>0) then y=2*x-1
y=log(a)+log(b) else if (x<10) then
else y=2*x+10
y=sin(a)+sin(b) else if (x<100) then
end if y=2*x+100
else else
y=sin(a)+cos(b) y=x*x
end if end if
print *,"y=",y print *,"y=",y
end end
- 8 -
北洋无终子FORTRAN90基础练习 9(水仙花数是指一个三位整数,该数三个数位的9-2.判断两位整数n是否为守形数
333立方和等于该数本身。例如: 153,1,5,3输入n
输入一个3位整数,判断该数是否水仙花数。
n*n=k
输入n
n 1=MOD(k,10)
n 1=MOD(n,10) n 2=MOD(k/10,10)
s=n2*10+n1 n 2=MOD(n /10,10)
s= = n
Y N n 3= n /100
是守形数 不是守形数
s = n 1**3+ n 2**3+ n 3**3
s= = n
Y N 9-3判断是否为完数,6=1+2+3
是水仙花数 不是水仙花数 输入n
n*n=k program lb
integer n,n1,n2,n3,s n 1=MOD(k,10) write (*,*) "请输入n"
n 2=MOD(k/10,10) read *,n
n1=mod(n,10) s=n2*10+n1 n2=mod(n/10,10)
s= = n n3=n/100
Y N s=n1*n1*n1+n2*n2*n2+n3*n3*n3
if (s==n) then 是守形数 不是守形数
print *,n,"是水仙花数"
else
print *,"不是水仙花数"
end if
end 注:“=”与“==”
9-1 program lb
integer N,M,N1,N2,N3
read *,N
N1= MOD(N,10)
N2=( N /10,10)
N3= N /100
M=NI*100+N2*10+N3
Print *,"反向输出数为:",M
end
- 9 -
北洋无终子FORTRAN90基础练习 10.输入坐标点(x,y),判断其落在哪个象限中。 11(输入一个年号a,判断该年号是否闰年。
输入a 输入x,y
被4整除,不 能被100整除 x >0,y>0
或能被4 00整除 Y N
Y N x <0,y>0
Y N 是闰年 不是闰年
x <0,y<0 在第Y N program lb 一象在第 x>0 y<0 integer x 限 二象在第Y N write (*,*) "请输入x" ~input a year: 限 三象四象坐标 read *,x 限 限 轴 !if(mod(x,4).eq.0.and.mod(x,100).ne.0.or. program lb mod(x,400).eq.0) then
real x,y if (mod(x,4)==0.and.mod(x,100)/=0.or.
write (*,*) "请输入点的坐标x,y" mod(x,400)==0) then
read (*,*) x,y print *,"是闰年" ~this is a leap year
if (x>0.and.y>0) then else
print *,"在第一象限" print *,"不是闰年"
else if (x<0.and.y>0) then end if
print *,"在第二象限" end
else if (x<0.and.y<0) then 12(给定整数x,判定能否同时被6、9和14整除。
print *,"在第三象限" 输入x
else if (x>0.and.y<0) then
print *,"在第四象限" x能同时6, 9,14整除
else Y N
print *,"在坐标轴上" 能 不能
end if
end program lb
integer x
write (*,*) "请输入x"
read (*,*) x
!if (mod(x,6).eq.0.and.mod(x,9).eq.0.and.&
&mod(x,14).eq.0) then
if(mod(x,6)==0.and.mod(x,9)==0.and.&
&mod(x,14)==0) then
print *,"能同时整除"
else
print *,"不能同时整除"
end if
end
- 10
-
北洋无终子FORTRAN90基础练习
213. 求一元二次方程的根。 ax,bx,c,0输入整数N
N能被 3整除, 输入a,b,c Y N
d=b*b-4ac N能被 5整除 N能被 5整除
Y N Y N a==0?
Y N 被 7 被 7 被 7 被 7
Y N Y N Y N Y N b= =0 d>= 0? 357 35 37 3 57 5 7 无 Y N Y N program lb 提示 “不输出 x1=(-b)/(2a)
integer n “输是一x1=(-b+sqrt(d))/(2a) x2=sqrt(-d)/(2a)
write (*,*) "请输入任一整数n" 入错元二x2=(-b-sqrt(d))/(2a) 输出两根:
read *,n 误” 次方 x1+x2i
if (mod(n,3).eq.0) then 程” x1-x2i
if (mod(n,5).eq.0) then x=-c/b
if (mod(n,7).eq.0) then program lb print *,n,"能被3,5,7整除" real a,b,c,x1,x2,d1,d2,e else write (*,*) "请输入a,b,c" print *,n,"只能能被3,5整除" read *,a,b,c end if d=b*b-4*a*c else if (a==0) then if (mod(n,7).eq.0) then if (b.ne.0) then print *,n,"只能被3,7整除" print *,"方程为一次方程,根为:",-c/b else else print *,n,"只能被3整除" print *,"方程无意义" end if end if end if else else e=-b/2/a if (mod(n,5).eq.0) then if (d<0) then if (mod(n,7).eq.0) then d1=sqrt(-d)/2/a print *,n,"只能被5,7整除" write (*,*) "方程有虚根为:" else write(*,*)'x1=',e,'+',d1,'*i',',','x2=',e,'-',d1,'*i' print *,n,"只能被5整除" else if (d==0) then end if print *,"方程有两个相等的实根:",e else else if (mod(n,7).eq.0) then d2=sqrt(d)/2/a print *,n,"只能被7整除" print *,"方程有两个不同实 else 根:",'x1=',e+d2,',','x2=',e-d2 print *,n,"不能被3,5,7整除" end if end if end if end if end end if
end
- 11
-
北洋无终子FORTRAN90基础练习
14.1 14(某服装店经营套装,也单件出售,针对单笔交
易的促销政策为: 输入a,b (1)不少于50套,每套80元;
(2)不足50套,每套90元; b?
(3)只买上衣每件60元; a> N
(4)只买裤子每条45元; Y
编写计算器,分别输入一笔交易中上衣和裤子数,b>= 50? a>= 50? 计算应收款。 Y N Y N
输入a,b m=20b+60a m=30b+60a m=33a+45b m=45b+45a
a>=50 b>=50
输出m Y N
a>= b? b>= a? program lb Y N Y N real a,b,m
write (*,*) "请输入a,b" m=20b+60a m=35a+45b m=45a+45b m=30b+60a read (*,*) a,b
if (a>b) then 输出m if (b>=50) then
m=20*b+60*a
else program lb
m=30*b+60*a real a,b,m
end if write (*,*) "请输入a,b"
else read (*,*) a,b
if (a>=50) then if (a.ge.50.and.b.ge.50.and.a.ge.b) then
m=33*a+45*b m=20*b+60*a
else end if
m=45*a+45*b if (a.ge.50.and.b.ge.50.and.a.le.b) then
end if m=35*a+45*b
end if end if
print*,"应收款=",m if (a.lt.50.and.b.ge.a) then
end m=45*a+45*b
end if
if (a.lt.50.and.b.le.a) then
m=30*b+60*a
end if
print *,"应收款=",m
end
- 12
-
北洋无终子FORTRAN90基础练习
1(求s=n! 10
n!,1!,2!,......,10!。 1.2. 求,输入n n,1
program lb s=1,i=1 integer n,s,I,m
write (*,*)"请输入n" i<=n read*,n
s=1 s=s*i i=1 m=0 i=i+1 do while (i<=n)
s=s*i 输出s i=i+1
m=m+s program lb
end do integer n,s,i
print*,m write (*,*)"请输入n"
end read*,n
s=1
i=1
1.3.求1+1!+(1!+2!)+(1!+2!+3!)+„+() do while (i<=n)
program lb s=s*i
integer n,s,I,m i=i+1
write (*,*)"请输入n" end do
read*,n print*,s
s=1 end
i=1
m=0 1.1输出1~到n~
do while (i<=n) program lb
s=s*i integer n,s,i
i=i+1 write (*,*)"请输入n"
m=m+s read*,n
k=k+m s=1
end do i=1
print*,k do while (i<=n)
end s=s*i
i=i+1
print*,s
end do
end
- 13
-
北洋无终子FORTRAN90基础练习
111.3.求1+1!-(1!+2!)+(1!+2!+3!)-„+() 4. ,直到最后项小于0.00001。 s,1,,,??program lb 23
integer n,s,I,m s=0,t=1,i=1
write (*,*)"请输入n"
s=s+t read*,n
s=1 i=i+1
i=1
t=1/i k=1
m=0 t>=0.00001 h=-1
输出s do while (i<=n)
h=-h program lb
s=s*i real i,s,t
i=i+1 i=1
m=h*(abs(m)+s) s=0
k=k+m t=1
end do do while (t>=0.00001)
print*,k s=s+t end i=i+1 1.4求e=1+1+1/2!+…+1/n! t=1/i program lb end do
implicit none print*,s
integer::i=1 end
real::t=1,sum=0 11111,6s,6. ,最后项小于。 10,,,,......,22222do while(abs(t)>=1e-6) 1234n
sum=sum+t program lb
t=t/i real i,s,t
i=i+1 i=1
end do s=0
print*,'e=',sum t=1 end do while (t>=0.00001) 或 s=s+t program ex06 i=i+1
implicit none t=1/i*i
integer::i=1 end do
real::t=1,sum=0 print*,s
do end
sum=sum+t
t=t/i
i=i+1
if(abs(t)<1e-6) exit
end do
print*,'e=',sum
end
- 14
-
北洋无终子FORTRAN90基础练习 111111s=x**0+x**1+x**2+x**3+„x**n,n<=100 ,65.最后项<。 10s,1,,,,,,,?输入x 247111622
s=0,n=0,m=1
t=1,s=1,i=1
1/m>=10**-6
i<=100
m=m+n
t=t*x
s=s+1/m
s=s+t
n=n+1
i=i+1
print*,s
输出s
program lb program lb real s,x,t real n,s,m integer i s=0 write (*,*) "请输入x" n=0 read (*,*) x m=1 s=1 do while (1/n>=0.00001) t=1 m=m+n i=1 s=s+1/m do while (i<=100) n=n+1 t=t*x end do s=s+t print*,s i=i+1 end end do 10. print*,s n=0 end
i=1,10000
I能被3,5,7整除,
Y N
n=n+1
mod(n,10) ==0
Y N
- 15
-
北洋无终子FORTRAN90基础练习
s=a+aa+aaa+„+ 17((?)循环输入20个数,求其中的最大值。 输入a,n 输入x i=1,b=1 max=x i<=n i=2,20
b=b*10 输入x t=(b-1)/9*a max计算公式program lb
234 integer n,k,n1,n2,s xxx中,前20项的值 (1),,,,,??Ln,xx n=10 234
do while(n<=99) 输入x k=n*n
n1=mod(k,10) k=1,m=-1,t=0,ln=0,i=1 n2=MOD(k/10,10)
s=n2*10+n1 i<=20 if(s==n) then
print*,n m=-m end if
n=n+1 k=k*x end do
end t=m*k/i 求2,10000 之间所有的同构数(如:52 = 25, 252 = 625)
program ex15 ln=ln+t implicit none
integer::m,tmp1,tmp2,n=0 i=i+1 print*,'2-10000之间的所有同构数:'
do m=2,10000 输出ln tmp1=m
tmp2=m**2 program lb
do while(mod(tmp1,10)==mod(tmp2,10).and.tmp1/=0) real x,m,k,i
tmp1=tmp1/10 write(*,*)"请输入x"
tmp2=tmp2/10 read*,x
end do k=1;m=-1;t=0;ln=0;i=1
if (tmp1==0) then do while (i<=20)
print 100,m m=-m
n=n+1 k=k*x
if (mod(n,5)==0) print* t=m*k/i
end if ln=ln+t
end do i=i+1
print* end do 100 format(1X,I4\) print*,ln End end
- 18
-
北洋无终子FORTRAN90基础练习
111,21.输出Fibonacci数列:1、1、2、3、5、8、13、,19(利用公式,求圆周率,,1,,,,??21„„的前40项。 4357
,6要求最后一项绝对值小于。 10a=1,b=1
k=1,s=1,t=1,m=1
输出a,b
m=-m
i=1 k=k+2
t=m/k i<=19
s=s+t
a=a+b
,t,>=10**-6
b=a+b PI=sx4
输出PI 输出a,b
i=i+1 program lb
real k,s,t,m,PI program lb
k=1;s=1;t=1;m=1 integer a,b
do while (abs(t)>=1.0E-6) write(*,*)"a,b"
m=-m read*,a,b
k=k+2 i=1
t=m/k do while (i<=19)
s=s+t a=a+b
PI=s*4 b=a+b
end do print*,a,b
print*,PI i=i+1
end end do
2222 end 246(2n),,2,,,,??,1,33,55,7(2n,1),(2n,1)
直到n>,1000。
- 19
-
北洋无终子FORTRAN90基础练习
5.输出Fibonacci数列:1、1、2、3、5、8、13、21„„
的前40项。 输入m
a=1,b=1
i=2
输出a,b
i<=sqrt(m)
i=2
mod (m,i)==0
Y N i<=39
flag=.false.
c=a+b exit
a=b
i=i+1
b=c flag= .true.
Y N
输出c
输出m是素数 输出m不是素数
i=i+1 或
program lb
program lb integer m,i
integer a,b write(*,*)"m"
write(*,*)"a,b" read*,m
read*,a,b i=2
i=2 do while (i<=m-1.and.mod(m,i)/=0)
do while (i<=39) i=i+1
c=a+b end do
a=b if(i>m-1.and.m>1) then
b=c print*,"y"
print*,c else
i=i+1 print*,"n"
end do end if
end end
- 20
-
北洋无终子FORTRAN90基础练习
或 23.输入一个整数m,判断该数是否素数。
program lb 输入m integer m,i,j
write(*,*)"m" flag=.ture. read*,m
j=SQRT(m)
i=2 do i=2,j
if (mod(m,i)==0) EXIT
i<=m-1 end do
if(i>j.and.m>1) then mod (m,i)==0
print*,"y" Y N
else
flag=.false. print*,"n"
end if
exit end
program lb i=i+1
integer m,i flag= .true. write(*,*)"m" Y N read*,m
j=SQRT(m) 输出m是素数 输出m不是素数
i=2
program lb do
integer m,i if (mod(m,i)==0.or.i>j) EXIT
logical flag i=i+1
write(*,*)"m" end do
read*,m if(i>m-1.and.m>1) then
flag=.true. print*,"y"
i=2 else
do while (i<=m-1) print*,"n"
if(mod(m,i)==0) then end if
flag=.false. end
exit
end if
i=i+1
end do
if(flag) then
print*,"y"
else
print*,"n"
end if
end
- 21
-
北洋无终子FORTRAN90基础练习 12(找出1到1000之间的所有素数。 end if
m=m+1 m=1 end do
end m<=1000 或
program lb
flag=ture integer m,i
logical flag
i=2 write(*,*)"m"
read*,m
i<=sqrt(m) do m=1,1000,2
flag=.true. mod (m,i)==0
i=2 Y N
j=SQRT(m) flag=false do while (i<=j.and.flag)
if(mod(m,i)==0) flag=.false. exit i=i+1
end do
if(flag) then i=i+1
print*,"m" flag= true end if Y N m=m+1
end do 输出m
end
m=m+1
program lb
integer m,i
logical flag
write(*,*)"m"
read*,m
do while (m<=1000)
flag=.true.
i=2
do while (i<=sqrt(m))
if(mod(m,i)==0) then
flag=.false.
exit
end if
i=i+1
end do
if(flag) then
print*,"m"
- 22
-
北洋无终子FORTRAN90基础练习 10(求两个整数m和n的最大公约数和最小公倍数。
输入m,n 输入a,b
m >n? a >b Y N Y N
i=n i=m m=a,n=b m=b,n=a
i>=1 r=mod(m,n)
mod(m,i)==0and mod(n,i)==0 r/=0 Y N
exit m=n
n=r i=i-1
r=mod(m,n) 输出i
输出n为最大公约数
输出a*b/n为最小公倍数 输入m,n
m >n?
。12((?)用牛顿迭代法,求a的平方根。 Y N
i=m i=n
输入a
i>=1
x0=a/2 mod(I,m)==0and mod(I,n)==0
Y N x1=(x0+a/x0)/2 exit
,x1-x0,>=
i=i+1
x 0=x1
输出i x1=(x0+a/x0)/2
输出x1
- 23
-
北洋无终子FORTRAN90基础练习 11(百钱买百鸡问题。假定公鸡每只2元,母鸡每只搬砖问题:36块砖36人搬,男搬4块,女搬3块,2
3元,小鸡每只0.5元。现有100元,要求买100只鸡,编个小儿抬1块,要求1次搬完。问需男、女和小儿各多少
程求出公鸡只数x、母鸡只数y和小鸡只数z。 人。
x=0,9
x=0,50
y=0,12
y=0,30
z=36-x-y z=0,100 4x+3y+0.5z= 36
2x+3y+0.5z= 100 Y N
x+y+z= 100 输出x,y,z
Y N
输出x,y,z 41dx13((?)用矩形法求定积分。 2, ,41,x
x=0,50 n=1000
w=8/1000 y=0,33
s=0 z=100-x-y
2x+3y+0.5z= 100 Y N
输出x,y,z s=s+w/(1+x*x)
输出s
x=0,50
y=20-3x/5取整
z=80-2x/5取整
x+y+z=0,y>=0 z>=0
Y N
输出x,y,z
- 24
-