资源描述
湖南省一级程序设计题库过程及答案
- 79 -
1 编程序求出1-200以内的能被7整除的数的平方和。 377986
clea
s=0
m=0
for i=1 to 200
if i%7=0
m=i^2
s=s+m
endif
endfor
?s
2 编程序求1~99的平方根的和并输出结果。(保留小数点两位) 661.46
clea
s=0
for i=1 to 99
s=s+sqrt(i)
endfor
?round(s,2)
3 编程序求1~55的平方根的和并输出结果。(保留小数点两位) 275.43
clea
s=0
for i=1 to 55
s=s+sqrt(i)
endfor
?round(s,2)
4 编程序统计1~1000能被3整除的数的个数。 333
clea
s=0
for n=1 to 1000
if n%3=0
s=s+1
endif
endfor
?s
7 编程序求出1到5000之间的能被5整除的前若干个偶数之和,当和大于500 时程序退出。 550
clea
s=0
for n=10 to 5000 step 10
s=s+n
if s>500
exit
endif
endfor
?s
8 编程序求在3000以内被17或者23整除的正整数数的个数。 299 clea
s=0
for n=1 to 3000
if n%17=0 or n%23=0
s=s+1
endif
endfor
?s
9 序求在1000以内被17或者23整除的正整数数的个数。 99
clea
s=0
for n=1 to 1000
if n%17=0 or n%23=0
s=s+1
endif
endfor
?s
10 编程序求在5000以内被17或者23整除的正整数数的个数。 499
clea
s=0
for n=1 to 5000
if n%17=0 or n%23=0
s=s+1
endif
endfor
?s
11 编程序求出1-100以内的能被3整除的数的平方和。 112761
clea
s=0
for n=1 to 100
if n%3=0
s=s+n^2
endif
endfor
?s
12 已知一个数列的前3个数为0,0,1,以后每个数为前3个数的和,编程序求此数列的第36个数。 334745777
clea
dime f(36)
f(1)=0
f(2)=0
f(3)=1
s=0
for n=4 to 36
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
13 编程序求出1-100以内的能被9整除的数的平方和。 40986
clea
s=0
for n=1 to 100
if n%9=0
s=s+n^2
endif
endfor
?s
14 编程序求出1-200以内的能被3整除的数的平方和。 882189
clea
s=0
for n=1 to 200
if n%3=0
s=s+n^2
endif
endfor
?s
15 编程序求出1-7000以内能被3或者7整除数的个数。 3000
clea
s=0
for n=1 to 7000
if n%3=0 or n%7=0
s=s+1
endif
endfor
?s
16 序求出1-3000以内能被3或者5整除数的个数。 1400
clea
s=0
for n=1 to 3000
if n%3=0 or n%5=0
s=s+1
endif
endfor
?s
17 编程序求出1-5000以内能被3或者7整除数的个数。 2142
clea
s=0
for n=1 to 5000
if n%3=0 or n%7=0
s=s+1
endif
endfor
?s
18 编程序求出1-6000以内能被3或者5整除数的个数。 2800
clea
s=0
for n=1 to 6000
if n%3=0 or n%5=0
s=s+1
endif
endfor
?s
19 编程序求出1-4000以内能被3或者11整除数的个数。 1575
clea
s=0
for n=1 to 4000
if n%3=0 or n%11=0
s=s+1
endif
endfor
?s
20 编程序求出1-5000以内能被37整除的整数之和。 339660
clea
s=0
for n=1 to 5000
if n%37=0
s=s+n
endif
Endfor
?s
21 编程序求出1-6000以内能被23整除的整数之和。 780390
clea
s=0
for n=1 to 6000
if n%23=0
s=s+n
endif
endfor
?s
22 编程序求出1-3000以内能被33整除的整数之和。 135135
clea
s=0
for n=1 to 3000
if n%33=0
s=s+n
endif
endfor
?s
23 编程序求出1-5000以内能被15整除的整数之和。 834165
clea
s=0
for n=1 to 5000
if n%15=0
s=s+n
endif
endfor
?s
24 编程序求出100到200之间同时满足除3余2和除5余3条件的数的个数。 6
clea
s=0
for n=100 to 200
if n%3=2 and n%5=3
s=s+1
endif
endfor
?s
25 编程序求出1到300之间同时满足除3余2和除5余3条件的数的个数。 20
clea
s=0
for n=1 to 300
if n%3=2 and n%5=3
s=s+1
endif
endfor
?s
26 编程序求出100到500之间同时满足除3余2和除5余3条件的数的个数。 26
clea
s=0
for n=100 to 500
if n%3=2 and n%5=3
s=s+1
endif
endfor
?s
27
编程序求出1到400之间同时满足除3余2和除5余3条件的数的个数。 27
clea
s=0
for n=1to 400
if n%3=2 and n%5=3
s=s+1
endif
endfor
?s
28 编程序求出100到600之间同时满足除3余2和除5余3条件的数的个数。 33
clea
s=0
for n=100 to 600
if n%3=2 and n%5=3
s=s+1
endif
endfor
?s
29
编程序求出1到500之间同时满足除3余2和除5余3条件的数的个数。 33
clea
s=0
for n=1to 500
if n%3=2 and n%5=3
s=s+1
endif
endfor
?s
30 1 编程序求出 2+4+8+16+32+…这样的数之和。如果累加数大于500时,则程序终止并输出结果。 510
clea
s=0
for n=1 to 100
s=s+2^n
if s>500
exit
endif
endfor
?s
31 编程序求出1~100所有整数的立方和并输出结果。 25502500
clea
s=0
for n=1 to 100
s=s+n^3
endfor
?s
32 编程序求出1~110所有整数的立方和并输出结果。 37271025
clea
s=0
for n=1 to 110
s=s+n^3
endfor
?s
33 编程序求出1~66所有整数的立方和并输出结果。 4888521
clea
s=0
for n=1 to 66
s=s+n^3
endfor
?s
34 编程序求出1~150所有整数的立方和并输出结果。 128255625
clea
s=0
for n=1 to 150
s=s+n^3
endfor
?s
35 编程序求出1~180所有整数的立方和并输出结果。 265364100
clea
s=0
for n=1 to 180
s=s+n^3
endfor
?s
36 编程序求出1~200所有整数的立方和并输出结果。 404010000
clea
s=0
for n=1 to 200
s=s+n^3
endfor
?s
37 编程序求出1~210所有整数的立方和并输出结果。 490844025
clea
s=0
for n=1 to 210
s=s+n^3
endfor
?s
38 编程序求出S=1~130所有整数的立方和并输出结果。 72505225
clea
s=0
for n=1 to 130
s=s+n^3
endfor
?s
39 编写程序,计算1000以内有多少个这样的数,该数既能被6整除又能被8整除。 41
clea
s=0
for n=1 to 1000
if n%6=0 and n%8=0
s=s+1
endif
endfor
?s
40 编程序求1~110所有整数的平方和并输出结果。 449735
clea
s=0
for n=1 to 110
s=s+n^2
endfor
?s
41 编程序求1~120所有整数的平方和并输出结果。 583220
clea
s=0
for n=1 to 120
s=s+n^2
endfor
?s
42 编程序求1~80所有整数的平方和并输出结果。 173880
clea
s=0
for n=1 to 80
s=s+n^2
endfor
?s
43 编程序求1~150所有整数的平方和并输出结果。 1136275
clea
s=0
for n=1 to 150
s=s+n^2
endfor
?s
44 编程序求1~60所有整数的平方和并输出结果。 73810
clea
s=0
for n=1 to 60
s=s+n^2
endfor
?s
45 编程序求1~90所有整数的平方和并输出结果。 247065
clea
s=0
for n=1 to 90
s=s+n^2
endfor
?s
46 编程序求1~108所有整数的平方和并输出结果。 425754
clea
s=0
for n=1 to 108
s=s+n^2
endfor
?s
47 编程序求1~145所有整数的平方和并输出结果。 1026745
clea
s=0
for n=1 to 145
s=s+n^2
endfor
?s
48 编程序求1~250所有整数的平方和并输出结果。 5239625
clea
s=0
for n=1 to 250
s=s+n^2
endfor
?s
49 编程序求1~300所有整数的平方和并输出结果。 9045050
clea
s=0
for n=1 to 300
s=s+n^2
endfor
?s
50 编程序求出1到5000之间的能被7整除的前若干个数之和,当和大于1500时退出 并输出结果。 1617
clea
s=0
for n=1 to 5000
if n%7=0
s=s+n
endif
if s>1500
exit
endif
endfor
?s
51 编程序求出1到3000之间的能被3整除的前若干个数之和,当和大于600时退出并输出结果。 630
clea
s=0
for n=1 to 3000
if n%3=0
s=s+n
endif
if s>600
exit
endif
endfor
?s
52 编程序求出1到2000之间的能被9整除的前若干个数之和,当和大于500时退出并输出结果。 594
clea
s=0
for n=1 to 2000
if n%9=0
s=s+n
endif
if s>500
exit
endif
endfor
?s
53编程序求出1到6000之间的能被5整除的前若干个偶数之和,当和大于650时退出并输出结果。 660
clea
s=0
for n=1 to 6000
if n%5=0 and n%2=0
s=s+n
endif
if s>650
exit
endif
endfor
?s
54 编程序求出1到7000之间的能被5整除的前若干个偶数之和,当和大于500时退出并输出结果。 550
clea
s=0
for n=1 to 7000
if n%5=0 and n%2=0
s=s+n
endif
if s>500
exit
endif
endfor
?s
55编程序求出1到4000之间的能被5整除的前若干个偶数之和,当和大于400时退出并输出结果。 450
clea
s=0
for n=1 to 4000
if n%5=0 and n%2=0
s=s+n
endif
if s>400
exit
endif
endfor
?s
56 编程序求出1到8000之间的能被5整除的前若干个偶数之和,当和大于750时退出并输出结果。 780
clea
s=0
for n=1 to 8000
if n%5=0 and n%2=0
s=s+n
endif
if s>750
exit
endif
endfor
?s
57 编程序统计1~200能被3整除的个数。 66
clea
s=0
for n=1 to 200
if n%3=0
s=s+1
endif
endfor
?s
58 编程序统计1~300能被3整除的个数。 100
clea
s=0
for n=1 to 300
if n%3=0
s=s+1
endif
endfor
?s
59 编程序统计200~400能被3整除的个数。 67
clea
s=0
for n=200 to 400
if n%3=0
s=s+1
endif
endfor
?s
60 编程序统计150~300能被3整除的个数。 51
clea
s=0
for n=150 to 300
if n%3=0
s=s+1
endif
endfor
?s
61 编程序统计150~400能被3整除的个数。 84
clea
s=0
for n=150 to 400
if n%3=0
s=s+1
endif
endfor
?s
62 编程序统计100~500能被3整除的个数。 133
clea
s=0
for n=100 to 500
if n%3=0
s=s+1
endif
endfor
?s
63 编程序统计200~600能被3整除的个数。 134
clea
s=0
for n=200 to 600
if n%3=0
s=s+1
endif
endfor
?s
64 编程序统计200~300能被3整除的个数。 34
clea
s=0
for n=200 to 300
if n%3=0
s=s+1
endif
endfor
?s
65 编程序统计300~500能被3整除的个数。 67
clea
s=0
for n=300 to 500
if n%3=0
s=s+1
endif
endfor
?s
66 编程序求1~65的平方根的和并输出结果。(保留小数点两位) 353.19
clea
s=0
for n=1 to 65
s=s+sqrt(n)
endfor
?round(s,2)
67 编程序求1~66的平方根的和并输出结果。(保留小数点两位) 361.32
clea
s=0
for n=1 to 66
s=s+sqrt(n)
endfor
?round(s,2)
68 编程序求1~85的平方根和并输出结果。(保留小数点两位) 526.85
clea
s=0
for n=1 to 85
s=s+sqrt(n)
endfor
?round(s,2)
69 编程序求1~95的平方根的和并输出结果。(保留小数点两位) 621.97
clea
s=0
for n=1 to 95
s=s+sqrt(n)
endfor
?round(s,2)
70 编程序求1~125的平方根的和并输出结果。(保留小数点两位) 937.08
clea
s=0
for n=1 to 125
s=s+sqrt(n)
endfor
?round(s,2)
71 编程序求1~135的平方根的和并输出结果。(保留小数点两位) 1051.31
clea
s=0
for n=1 to 135
s=s+sqrt(n)
endfor
?round(s,2)
72 编程序求1~155的平方根的和并输出结果。(保留小数点两位) 1292.51
clea
s=0
for n=1 to 155
s=s+sqrt(n)
endfor
?round(s,2)
73 编程序求1~115的平方根的和并输出结果。(保留小数点两位) 827.32
clea
s=0
for n=1 to 115
s=s+sqrt(n)
endfor
?round(s,2)
74 编程序求1~78的平方根的和并输出结果。(保留小数点两位) 463.46
clea
s=0
for n=1 to 78
s=s+sqrt(n)
endfor
?round(s,2)
75 已知一个数列的前3个数为0,1,2,以后每个数为前3个数的和,编程序求此数列的第30个数。 24548655
clea
dime f(30)
f(1)=0
f(2)=1
f(3)=2
s=0
for n=4 to 30
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
76 已知一个数列的前3个数为0,1,1,以后每个数为前3个数的和,编程序求此数列的第20个数。 35890
clea
dime f(20)
f(1)=0
f(2)=1
f(3)=1
s=0
for n=4 to 20
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
77 已知一个数列的前3个数为0,1,2,以后每个数为前3个数的和,编程序求此数列的第25个数。 1166220
clea
dime f(25)
f(1)=0
f(2)=1
f(3)=2
s=0
for n=4 to 25
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
78 已知一个数列的前3个数为1,2,3,以后每个数为前3个数的和,编程序求此数列的第20个数。 101902
clea
dime f(20)
f(1)=1
f(2)=2
f(3)=3
s=0
for n=4 to 20
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
79 已知一个数列的前3个数为0,1,2,以后每个数为前3个数的和,编程序求此数列的第35个数。 516743378
clea
dime f(35)
f(1)=0
f(2)=1
f(3)=2
s=0
for n=4 to 35
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
80 已知一个数列的前3个数为1,2,3,以后每个数为前3个数的和,编程序求此数列的第35个数。 950439251
clea
dime f(35)
f(1)=1
f(2)=2
f(3)=3
s=0
for n=4 to 35
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
81 已知一个数列的前3个数为3,4,5,以后每个数为前3个数的和,编程序求此数列的第28个数。 25527448
clea
dime f(28)
f(1)=3
f(2)=4
f(3)=5
s=0
for n=4 to 28
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
82已知一个数列的前3个数为3,4,5,以后每个数为前3个数的和,编程序求此数列的第33个数。 537346739
clea
dime f(33)
f(1)=3
f(2)=4
f(3)=5
s=0
for n=4 to 33
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
83 已知一个数列的前3个数为3,4,5,以后每个数为前3个数的和,编程序求此数列的第26个数。 7545856
clea
dime f(26)
f(1)=3
f(2)=4
f(3)=5
s=0
for n=4 to 26
f(n)=f(n-3)+f(n-2)+f(n-1)
s=f(n)
endfor
?s
84 编程序求2+4+8+16+32+…这样的数之和。如果累加数大于1500时,则程序终止并输出结果。 2046
clea
s=0
for n=1 to 100
q=2^n
s=s+q
if s>1500
exit
endif
endfor
?s
85 编程序求2+4+8+16+32+…这样的数之和。如果累加数大于980时,则程序终止并输出结果。 1022
clea
s=0
for n=1 to 100
q=2^n
s=s+q
if s>980
exit
endif
endfor
?s
86 编程序求2+4+8+16+32+…这样的数之和。如果累加数大于3000时,则程序终止并输出结果。 4094
clea
s=0
for n=1 to 100
q=2^n
s=s+q
if s>3000
exit
endif
endfor
?s
87 编程序求2+4+8+16+32+…这样的数之和。如果累加数大于5000时,则程序终止并输出结果。 8190
clea
s=0
for n=1 to 100
q=2^n
s=s+q
if s>5000
exit
endif
endfor
?s
88 编程序求1+3+5+7+9+…这样的数之和。如果累加数大于750时,则程序终止并输出结果。 784
clea
s=0
for n=1 to 800 step 2
s=s+n
if s>750
exit
endif
endfor
?s
89 编程序求1+3+5+7+9+…这样的数之和。如果累加数大于1200时,则程序终止并输出结果。 1225
clea
s=0
for n=1 to 800 step 2
s=s+n
if s>1200
exit
endif
endfor
?s
90 编程序求2+4+8+16+32+…这样的数之和。如果累加数大于9000时,则程序终止并输出结果。 16382
clea
s=0
for n=1 to 100
q=2^n
s=s+q
if s>9000
exit
endif
endfor
?s
91 编程序求1+3+5+7+9+…这样的数之和。如果累加数大于1300时,则程序终止并输出结果。 1369
clea
s=0
for n=1 to 800 step 2
s=s+n
if s>1300
exit
endif
endfor
?s
92 编程序求1+3+5+7+9+…这样的数之和。如果累加数大于900时,则程序终止并输出结果。 961
clea
s=0
for n=1 to 800 step 2
s=s+n
if s>900
exit
endif
endfor
?s
93 编程序求1+3+5+7+9+…这样的数之和。如果累加数大于1000时,则程序终止并输出结果。 1024
clea
s=0
for n=1 to 800 step 2
s=s+n
if s>1000
exit
endif
endfor
?s
94 编程序求1~100能被7整除的个数。 14
clea
s=0
for n=1 to 100
if n%7=0
s=s+1
endif
endfor
?s
95 编程序求1~600能被11整除的个数。 54
clea
s=0
for n=1 to 600
if n%11=0
s=s+1
endif
endfor
?s
96 编程序求1~1000能被15整除的个数。 66
clea
s=0
for n=1 to 1000
if n%15=0
s=s+1
endif
endfor
?s
97 编程序求1~800能被5整除的个数。 160
clea
s=0
for n=1 to 800
if n%5=0
s=s+1
endif
endfor
?s
98 编写程序,求[1,1000]既能被6整除又能被7整除的数的个数。 2
clea
s=0
for n=1 to 100
if n%6=0 and n%7=0
s=s+1
endif
endfor
?s
99 编写程序,求[1,500]既能被3整除又能被5整除的数的个数。 33
clea
s=0
for n=1 to 500
if n%3=0 and n%5=0
s=s+1
endif
endfor
?s
100编写程序,求[1,500]既能被6整除又能被7整除的数之和。 2772
clea
s=0
for n=1 to 500
if n%6=0 and n%7=0
s=s+n
endif
endfor
?s
101 已知24有8个正整数因子(即:1,2,3,4,6,8,12,24),而24正好被其因子个数8整除。求[1,100]之间第10个能被其因子数目整除的正整数。 56
clea
s=0
q=0
for n=1 to 100
m=0
for j=1 to n
if n%j=0
m=m+1
endif
next
if n%m=0
s=s+1
q=n
if s>9 &&当它大于9时,q已经是第十个数了!
exit
endif
endif
endfor
?q
102求[666,777]范围内素数的个数。 16
clea
s=0
for n=666 to 777
q=0
for j=2 to sqrt(n)
if n%j=0
q=1
endif
next
if q=0
s=s+1
endif
endfor
?s
103求[351,432]之间所有既不能被3整除,又不能被8整除的正整数的个数。 47
clea
s=0
for n=351 to 432
if n%3!=0 and n%8!=0
s=s+1
endif
endfor
?s
104 求[444,666]范围内最大的素数是多少? 661
clea
s=0
for n=444 to 666
q=0
for j=2 to sqrt(n)
if n%j=0
q=1
endif
next
if q=0
s=n
endif
endfor
?s
105 有一个分数序列:2/1,3/2,5/3,8/5,13/8,21/13....(注:该数列从第二项开始,其分子是前一项的分子与分母的和,而其分母是前一项的分子),求出这个序列前24项的和。要求:按四舍五入的方式精确到小数点后第二位。 39.13
clea
s=0
k=0
m=2
n=1
for j=1 to 24
k=m/n
s=s+k
y=m
m=m+n
n=y
endfor
?round(s,2)
106 已知24有8个正整数因子(即:1,2,3,4,6,8,12,24),而24正好被其因子个数8整除。问[100,300]之间有多少个能被其因子数目整除的数。 19
clea
s=0
q=0
for n=100 to 300
m=0
for j=1 to n
if n%j=0
m=m+1
endif
next
if n%m=0
s=s+1
endif
endfor
?s
107 求[1,5000]之间能同时被3和7整除的数的个数。 238
clea
s=0
for n=1 to 5000
if n%3=0 and n%7=0
s=s+1
endif
endfor
?s
108 设某国今年的国民生产总值为45600亿元,若今后每年以8%的增长率增长,计算多少年后能实现国民生产总值翻两番? 19 2008
clea
s=0
dime f(1000)
f(1)=45600
f(2)=49248
f(3)=53187.84
q=2 && 从第二年开始计算年份,所以f(1)不算。
for n=4 to 1000
f(n)=f(n-1)*1.08
s=f(n)
q=q+1
if s>=182400
exit
endif
endfor
?q
109 求[1,5000]之间能被3或7整除的数的个数。 2142
clea
s=0
for n=1 to 5000
if n%3=0 or n%7=0
s=s+1
endif
endfor
?s
110 已知24有8个因子(即:1,2,3,4,6,8,12,24),而24正好被8整除。求[1,100]之间第二大能被其因子数目整除的数。 88
clea
s=0
q=0
for n=100 to 1 step -1
m=0
for j=1 to n
if n%j=0
m=m+1
endif
next
if n%m=0
s=s+1
q=n
if s>1 &&当它大于1时,q已经是第2个数了!
exit
endif
endif
endfor
?q
111 若某整数平方等于某两个正整数平方之和的正整数称为弦数。例如:由于3^2+4^2=5^2,则5为弦数,求[100,200]之间最大的弦数。 200
clea
s=100
q=0
for n=100 to 200
for j=1 to n-1
for k=1 to n-1
if k^2+j^2=n^2
q=n
if q>s
s=q
endif
endif
endfor
endfor
endfor
?s
112 若某整数N的所有因子之和等于N的倍数,则N称为多因子完备数,如数28,其因子之和1+2+4+7+14+28=56=2*28,28是多因子完备数。求[1,500]之间有多少个多因子完备数。 5
clea
s=0
for n=1 to 500
m=0
for j=1 to n
if n%j=0
m=m+j
endif
next
if m%n=0
s=s+1
endif
endfor
?s
113 若某整数N的所有因子之和等于N的倍数,则N称为多因子完备数,如数28,其因子之和1+2+4+7+14+28=56=2*28,28是多因子完备数。求[1,200]之间有多少个多因子完备数。 4
展开阅读全文