jeudi 16 novembre 2023

How to measure time elapsed by code when we don't have access to any library in C/C++ except malloc.h? [closed]

There is internal heuristics coding contest with weird rules of not allowing any libraries except malloc.h. I wish to measure the time elapsed since start of function execution. For heuristics there are I wish to execute a certain "strategy" just till Time Limit - 0.5 seconds. Is there any way to do that? Also, I wish to generate random number between 0 and 1, since quite lot of them depends on time in C and C++, is there any good way to generate without library usage?

I know a malloc generally returns address randomly so that could be used to generate big random number.




Aucun commentaire:

Enregistrer un commentaire