level 0
瞎写的。解决对正确。但是时间复杂度极高,不实用C
LSP
RINT "Press A to display."dollor = 100FOR fifcent = 0 TO 100 STEP 50 FOR twecent = 0 TO 100 STEP 20 FOR tencent = 0 TO 100 STEP 10 FOR fivecent = 0 TO 100 STEP 5 FOR twocent = 0 TO 100 STEP 2 FOR cent = 0 TO 100 IF cent + twocent + fivecent + tencent + twecent + fifcent = dollor THEN PRINT cent; "cent+"; twocent / 2; "twocent+"; fivecent / 5; "fivecent+"; tencent / 10; "tencent+"; twecent / 20; "twecent+"; fifcent / 50; "fifcent = 1 dollor": i = i + 1 NEXT cent NEXT twocent NEXT fivecent NEXT tencent NEXT twecentNEXT fifcentPRINT "i="; i
2004年03月22日 11点03分
2
LSP
RINT "Press A to display."dollor = 100FOR fifcent = 0 TO 100 STEP 50 FOR twecent = 0 TO 100 STEP 20 FOR tencent = 0 TO 100 STEP 10 FOR fivecent = 0 TO 100 STEP 5 FOR twocent = 0 TO 100 STEP 2 FOR cent = 0 TO 100 IF cent + twocent + fivecent + tencent + twecent + fifcent = dollor THEN PRINT cent; "cent+"; twocent / 2; "twocent+"; fivecent / 5; "fivecent+"; tencent / 10; "tencent+"; twecent / 20; "twecent+"; fifcent / 50; "fifcent = 1 dollor": i = i + 1 NEXT cent NEXT twocent NEXT fivecent NEXT tencent NEXT twecentNEXT fifcentPRINT "i="; i