fork(1) download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. static const int COUNT = 2500000;
  5.  
  6. int main() {
  7. std::vector<int> data{1, 2, 3, 4, 5};
  8.  
  9. int summ = 0;
  10. for (int i = 0; i < COUNT; i++) {
  11. try {
  12. summ += data.at(rand() % 10);
  13. } catch (...) {}
  14. }
  15.  
  16. std::cout << double(summ) / COUNT << std::endl;
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 3.69s 4316KB
stdin
Standard input is empty
stdout
1.50023