Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 给组数据和随机数生成的程序

Posted by Orthocenter at 2011-12-13 11:38:57 on Problem 1204
```10 10 10
UDVYVECUCW
VOEAHGQZVI
MKYOBIAIBQ
KKVSKKMJPN
DSRRRCDEBD
LPPOFGIFWX
BCFJDWPEUO
MGGEDTVBFJ
AKPTSZQCED
AHE
JORSOAAY
KBAED
AMDIPV
ABKDFUJ
KSVKK
CMIAI
JASHY
MKKSVKK
AMDIPVQ

ANS

2 3 B
7 3 A
4 5 H
3 6 E
2 3 D
4 4 G
5 5 B
4 7 H
4 6 G
3 6 E

#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#define L 1000
#define C 1000
#define W 1000
#define FOR(i,l,r) for (i=l;i<=r;i++)

using namespace std;

int fx[8]={-1,-1,0,1,1, 1, 0,-1},
fy[8]={0 ,1 ,1,1,0,-1,-1,-1};
int p,x,y,i,j;
char map[1005][1005];
bool flag[1005][1005][8];

int main(){
freopen("1204.in","w",stdout);
srand(time(0));
FOR(i,1,L){
FOR(j,1,C) map[i][j]='A'+rand()%26;
}
printf("%d %d %d\n",L,C,W);
FOR(i,1,L){
FOR(j,1,C) printf("%c",map[i][j]);
printf("\n");
}
FOR(i,1,W){
p=rand()%8;
x=rand()%(L-4)+3;
y=rand()%(C-4)+4;
while (flag[x][y][p]){
p=rand()%8;
x=rand()%(L-4)+3;
y=rand()%(C-4)+4;
}
flag[x][y][p]=true;
while (x<=L && x>=1 && y<=C && y>=1){
printf("%c",map[x][y]);
x+=fx[p]; y+=fy[p];
}
printf("\n");
}
return 0;
}
```

Followed by: