看板 b01902HW 關於我們 聯絡資訊
Write a program to compute a score for a integer number. If the input is zero or negative the score is -100. Otherwise we start with 0. If the number is a multiple of 3, add 3 to the score. If the number is a multiple of 5, add 5 to the score. If the number is between 100 and 200 (inclusive), add 50 to the score, else subtract 50 from the score. Now print the score. 我無法理解題意 一直寫不過QQ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.196.111
jeremy89183:輸入N N<=0 score=-100 10/11 00:31
jeremy89183:否則 若是N=3k score+3 N=5k score+5 10/11 00:32
jeremy89183:N在[100,200] score+50 若以上皆非 score-50 10/11 00:32
jeremy89183:這樣吧? 10/11 00:32
kazewind22:所以else subtract 50 意思是上面三個條件都錯? 10/11 00:41
jeremy89183:看起來是不在[100,200] (?) 10/11 00:49
kazewind22:解決了 謝囉 10/11 00:55