一个 gen
查看原帖
一个 gen
649485
TillTheEnd楼主2023/2/15 16:43
#include <cstdio>
#include <vector>
#include <assert.h>
#include <cmath>
#include <algorithm>
#include <random>
#include <ctime>
using namespace std;

default_random_engine e(time(0));

int rnd() {
  return e() % 20;
}

bool f;
int rd() {
  if(f) return 2 * e() % 10;
  else return 2 * rnd();
}


int main () {
int sx, sy, tx, ty;
int x1, y1, x2, y2, a, b, c, d;
  int op = rand() % 2;
  int t1 = e() % 2, t2 = e() % 2;
  if(op == 1) {
    a = b = rnd();
    c = rnd(); d = rnd();
    if(c > d) swap(c, d);
    f = e() % 2;
    sx = rd() + t1, sy = rd() + t2, tx = rd() + t1, ty = rd() + t2;
    x1 = sx, x2 = sy, y1 = tx, y2 = ty;
  } else {
    a = rnd(); b = rnd();
    c = rnd(); d = rnd();
    if(a > b) swap(a, b);
    if(c > d) swap(c, d);
    f = e() % 2;
    sx = rd() + t1, sy = rd() + t2, tx = rd() + t1, ty = rd() + t2;
    x1 = sx, x2 = sy, y1 = tx, y2 = ty;
  }
  printf("%d %d %d %d %d %d %d %d\n", x1, y1, x2, y2, a, b, c, d);
}

一组让我拍出问题的数据:

3 3
3 1
17 17 1 11

Yes
17 2
17 1
2023/2/15 16:43
加载中...