fork download
  1. #include <chrono>
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6. using namespace std::chrono;
  7. using clock = steady_clock;
  8.  
  9. clock::time_point start = clock::now();
  10. long long s = 0;
  11. for (long long i = 1; i <= 1000000000; ++i) s += i;
  12. clock::time_point stop = clock::now();
  13. auto diff = duration_cast<duration<double>>(stop - start).count();
  14. printf("%lld \n", s);
  15. printf("%f seconds", diff);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 1.32s 3340KB
stdin
Standard input is empty
stdout
500000000500000000 
1.319095 seconds