1 / 14

アルゴリズムの基礎

アルゴリズムの基礎. 演習問題( 3 ) J207. 1(1). 40 FOR K=1 TO N 50 A=A-B 60 B=A+B 70 NEXT K. ー2. ー3. ー1. 2. 3. 1. ー2. ー3. ー1. 1. ー2. ー3. ー1. 2. 3. 1. ー2. ー3. 1(2). 40 FOR K=1 TO N 50 A=A-B 60 B=A+B 70 NEXT K. 50 ÷ 6 =8 … 2. ー2. ー3. ー1. 2. 3. 1.

Download Presentation

アルゴリズムの基礎

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. アルゴリズムの基礎 演習問題(3) J207

  2. 1(1) 40 FOR K=1 TO N 50 A=A-B 60 B=A+B 70 NEXT K ー2 ー3 ー1 2 3 1 ー2 ー3 ー1 1 ー2 ー3 ー1 2 3 1 ー2 ー3

  3. 1(2) 40 FOR K=1 TO N 50 A=A-B 60 B=A+B 70 NEXT K 50 ÷ 6 =8 … 2 ー2 ー3 ー1 2 3 1 ー2 ー3 ー1 1 ー2 ー3 ー1 2 3 1 ー2 ー3

  4. 1(3) 40 FOR K=1 TO N 50 A=A-B 60 B=A+B 65 IF A<0 THEN PRINT "*"; 70 NEXT K 70 ÷ 6=11 … 4 11 × 3 + 3 = 36 ー2 ー3 ー1 2 3 1 ー2 ー3 ー1 1 ー2 ー3 ー1 2 3 1 ー2 ー3

  5. 2(1) 50 FOR I=1 TO D 60 C=C*A 70 NEXT I 9

  6. 2(2) 50 FOR I=1 TO D 60 C=C*A 70 NEXT I A2 A3 A4

  7. 2(3) 50 FOR I=1 TO D 60 C=C*A 70 NEXT I 3B = 729 32 33 34 3B

  8. 3(1) 開始 N=3 (ア) N = N * (N - 1) (イ) N = N - 2 (ウ)N の値を表示 N<100 はい ① いいえ 終了 6 12 90 7656 4 10 88 7654

  9. 3(2) 開始 N=3 (ア) N = N - 2 (イ) N = N * (N - 1) (ウ)N の値を表示 N<100 はい ① いいえ 終了 1 ー2 4 10 88 7656 0 6 12 90

  10. 3(3) 開始 N=3 (ア) N = N * (N - 1) (イ) N = N - 2 N<100 はい いいえ (ウ)N の値を表示 終了 6 12 90 7656 4 10 88 7654

  11. 4(1) 50 PRINT "Q=";Q;"R=";R 60 IF R<B THEN GOTO 100 70 R=R-B 80 Q=Q+1 90 GOTO 50 100 END 0 1 2 3 11 2 8 5

  12. 4(2) 50 PRINT "Q=";Q;"R=";R 60 IF R<B THEN GOTO 100 70 R=R-B 80 Q=Q+1 90 GOTO 50 100 END 0 1 2 3 4 1000 993 986 979 972

  13. 4(2) 0 1 2 3 4 1000 993 986 979 972 a20 = 1000 ー 7 × ( 20 ー 1 ) = 1000 ー 133 = 867 an = 1000 ー 7 × ( n ー 1 ) = 1000 ー 7n + 7 = 1007 ー 7n

  14. 4(2) 0 1 2 3 4 1000 993 986 979 972 1007 ー 7n < 7   ∴ n > 1000/7 = 142.・・・ a143 = 1000 ー 7 × ( 143 ー 1 ) = 1000 ー 7 × 142 = 6

More Related