#40043: 幫你解決問題


yp11251119@yphs.tp.edu.tw (807-29康晉綸)


這題不需要用到陣列或其他有的沒的

只要判斷書入的變數是否大於上一個變數就可以了

程式碼:

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
    long long int a , b,ans=0;
    cin >> b;
    for(int i = 0 ; i < b ; i++){
        cin>>a;
        if(a > ans) ans = a;
    }
    cout << ans << endl;
}