제출 #660798

#제출 시각아이디문제언어결과실행 시간메모리
660798roddarichardGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; ++i) { cin >> arr[i]; } int diffarr[n]; diffarr[0]=arr[0]; for (int i = 1; i < n; i++){ diffarr[i] = arr[i] - arr[i - 1]; } int sum=0; for (int i=0;i<n;++i){ if (diffarr[i]>0){ sum+=diffarr[i]; } } cout << sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...