|
ゴンとも |
|
十進Basic で
print time$ for x=1 to 1000 let s=0 for a=1 to 1000 for b=a+1 to 1000 if (b+1-a)*(a+b)/2=x then let s=s+1 next b next a if s=7 then print x; end if next x end f9押して 13:06:16 105 135 165 189 195 210 231 255 270 273 285 297 330 345 351 357 375 378 385 390 399 420 429 435 455 459 462 465 483 15:07:09 s=7の所を変えてもあと変数の終わりの値でいくらでもでてくるので プログラム向きの問題でしたね!! あと変数の終わりの値とかとおり数が大きいと時間がかかりますね。 |
|
5月19日(木) 13:26:45
51524 |