一个好的时间函数

#include <bits/stdc++.h>
#include <sys/time.h>
#include <unistd.h>
using namespace std;
int main(){
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv,&tz);
  srand(tv.tv_sec^tv.tv_usec);
  int n=1000;
  cout<<n<<" "<<rand()%(int)1e4-2e4<<" "<<rand()%(int)1e4+1<<endl;
  for (int i=1; i<=n; ++i)
    {
      for (int j=1; j<=n; ++j){
    cout<<rand()%((int)1e9)+1<<" ";
    //cout<<(rand()&1?0:rand()%3+1)<<" ";
    //cout<<1<<" ";
    //cout<<i*10000+j<<" ";
      }
    cout<<endl;
    }
}

妈妈再也不用担心我的对拍太慢啦!

猜你喜欢

转载自www.cnblogs.com/Yuhuger/p/10392753.html