fork(4) download
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int Volume(int* _Array)
  6. {
  7. int lv_Volume = 0;
  8.  
  9. auto lv_Max = _Array[0];
  10. for(int lv_SmallVolume = 0; *_Array; ++_Array)
  11. if(*_Array >= lv_Max)
  12. {
  13. lv_Max = *_Array;
  14. lv_Volume += lv_SmallVolume;
  15. lv_SmallVolume = 0;
  16. }
  17. else
  18. lv_SmallVolume += lv_Max - *_Array;
  19.  
  20. return lv_Volume;
  21. }
  22.  
  23. int main()
  24. {
  25. int lv_Array[] = {2,5,1,3,1,2,1,7,7,6};
  26. auto lv_Volume = Volume(lv_Array);
  27.  
  28. if( lv_Volume == 17)
  29. cout << "PASS";
  30. else
  31. cout << "FAIL";
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
PASS