題目連結:https://zerojudge.tw/ShowProblem?problemid=i071 :::warning 紀錄小明家的高度,並從小明家往左、往右比較。 以變數(lefthighest、righthighest)記錄小明家左邊、右邊最高樓高(初值為小明家樓高)。從小明家往左、往右比較,若比較的樓高>lefthighest、righthighest,則答案sum+1(記得每次執行時將sum重新計算),並調整lefthighest、righthighest。 <font color=cake>注意小明家高度在陣列的位置,要存在輸入位置-1,即building[location-1]</font>。 ::: C++程式碼
2/7/2023題目連結:https://zerojudge.tw/ShowProblem?problemid=f373 :::warning 利用多重選擇語法判斷。 若<font color=cake>有折價且價格相同</font>,則<font color=cake>以天天百貨</font>當作優先考量 ; 若<font color=fart>無折價</font>,輸出價格為<font color=fart>原價</font>。 ::: C++程式碼 #include<bits/stdc++.h>
2/7/2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up