1234567891011121314151617181920212223242526272829303132333435 |
- #include "Vector.h"
- #include <time.h>
- using namespace std;
- void iosif(int count, int step)
- {
- clock_t start = clock();
- Vector v;
- for(int i = 0; i < count; i++) {
- v.add(i);
- }
- // cout << v;
- int i = 0;
- while(v.lenght > 1)
- {
- // cout << v;
- v.pop(i);
- i += step-1;
- i %= v.lenght;
- }
- // cout << v;
- clock_t end = clock();
- double sec = (double)(end - start) / CLOCKS_PER_SEC;
- cout << "time: " << sec << " answer: " << v[0];
- }
- int main() {
- iosif(1000, 3);
- iosif(5000, 3);
- iosif(10000, 3);
- iosif(50000, 3);
- }
|