fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int FindSmallestElement(int arr[], int q){
  4. int temp = arr[0];
  5. for (int p=0; p<q; p++){
  6. if (temp< arr[p])
  7. temp = arr[p];
  8. }
  9.  
  10. return temp;
  11. }
  12. int main() {
  13. ios_base::sync_with_stdio(false);
  14. cin.tie(NULL);
  15.  
  16. unsigned int N;
  17. cin >> N;
  18. int COBOL[N];
  19. int POLE[N];
  20. int DNUT[N];
  21. for (int i=0; i<N; i++){
  22. cin >> COBOL[i] >> POLE[i] >> DNUT[i];
  23. }
  24. int TIME[N];
  25. for (int x=0; x<N ; x++){
  26. for (int y=0; y<x; y++){
  27. TIME[x] += COBOL[y];
  28. }
  29. }
  30. int z = FindSmallestElement(TIME,N);
  31. cout << z;
  32.  
  33.  
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0.28s 4428KB
stdin
Standard input is empty
stdout
2093626876