看板 PLT 關於我們 聯絡資訊
※ 引述《finaldark (......................)》之銘言: : 有沒有人可以解釋一下, : 我實在是看不懂, : 有人可以給個 hint嗎 : 謝謝 : ********************************************************************* : 95年高考-程式設計 BNF: http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form : 二、試寫出一BNF文法,使其產生二進位數字,且數字之值為3之倍數。(20分) : 答:3倍數之文法如下 : <N3> → <N3>0 | <N1>1 | 0 模三餘零 = 餘零的數 * 2 or 餘一的數 * 2 + 1 or 0 : <N1> → <N2>0 | <N3>1 | 1 模三餘一 = 模三餘二 * 2 or 模三餘零 * 2 + 1 or 1 : <N2> → <N1>0 | <N2>1 模三餘二 = 模三餘一 * 2 or 模三餘二 * 2 + 1 : ********************************************************************* -- And in that line now was a whiskered old man, with a linen cap and a crooked nose, who waited in a place called the Stardust Band Shell to share his part of the secret of heaven: that each affects the other and the other affects the next, and the world is full of stories, but the stories are all one. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.30.54
finaldark:謝謝 我懂了 :P 12/04 15:20