1 #include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
using namespace std;
const int max_rand = ;
int a[max_rand], b[max_rand];
struct node
{
int x, y;
bool operator < (const node q) const
{
if(x == q.x)
return y < q.y;
return x < q.x;
}
}RAND[]; int main()
{
for (int i = ; i < max_rand; i ++)
a[i] = b[i] = i;
b[] = -;
int aa = , bb = ;
// time_t t;
// srand((unsigned) time(&t));
srand((unsigned)time(NULL));// let the seed accroding to time
for (int i = ; i < ; i ++)
{
int x = rand()%; //make x between 0 and 2000(include)
int y = rand()%; //same up;
/* double text = (double)rand()/RAND_MAX*(bb-aa) +aa; //produce double text between aa and bb
printf ("%f\n", text);
getchar();
*/
if((!x || !y)||(!a[x] && b[y] == -))
{
i --;
continue;
}
RAND[i] = (node){x, y}; a[x] = ;
b[y] = -;
}
sort(RAND, RAND +);
for (int i = ; i < ; i ++)
{
printf("%d %d\n", RAND[i].x, RAND[i].y);
// getchar();
}
return ;
}

最新文章

  1. windows10简单试用(多图,连薛定谔的猫都杀死了)
  2. MySQL数据表range分区例子
  3. awk 的使用方法
  4. R语言——七月
  5. 常用SQL Server日期格式化
  6. CentOS7配置双网卡绑定
  7. 浅谈PHP与手机APP开发(API接口开发)
  8. SublimeText使用技巧
  9. Springmvc jar包介绍
  10. 第2章 数字之魅——斐波那契(Fibonacci)数列
  11. .Net基础学习
  12. 层模型--绝对定位(position:absolute)
  13. Java项目打包工具安装失败解决方法
  14. mysql5.7.21安装要点记录
  15. C#基础知识总结(二)
  16. 网站之.htaccess文件
  17. IDEA常用配置
  18. 高性能消息中间件——NATS
  19. Crontab定时执行Oracle存储过程
  20. socket之 select模型

热门文章

  1. Axios 使用时遇到的问题
  2. UVA Foreign Exchange
  3. Oracle中set serveroutput on介绍
  4. Tomcat连HBase报错: HTTP Status 500 - java.lang.AbstractMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext
  5. R语言适配问题集锦
  6. hdu_1166,线段树单点更新
  7. poj--2083--Fractal(dfs)
  8. Windows下mnist数据集caffemodel分类模型训练及测试
  9. rsync同步操作命令
  10. Mysql常见更改密码方法