算出代码运行时间

#include <bits/stdc++.h>
#define maxn 1000005

typedef long long ll;

using namespace std;

clock_t start,stop;

ll a[maxn];
void kk()
{
    for(int i = 1; i <= 1000000; i ++)
    {
        a[i] = i;
    }
}
int main()
{
    double t;
    start = clock();
    kk();
    stop = clock();
    t = ((double)(stop - start)) / CLK_TCK;
    cout << t << endl;
    return 0;
}

  

posted @ 2018-11-10 18:22  WINDZLY  阅读(123)  评论(0编辑  收藏  举报