- /*
- 数字拼图[Digit Puzzle]由NxN的拼片组成
- 每个拼片是一个MxM的正方形,外面由一圈数字描述,数字只能是-1,0,1
- -1表示图形凹进去1,0表示图形是平的,1表示图形凸出来1,顺时针的
- */
- #include "stdafx.h"
- extern void init(int N,int M,int K);
- extern void add_piece(int piece[]);
- extern int find_center_piece();
- static int mseed;
- static int pseudo_rand(void){
- mseed=mseed*431345+2531999;
- return mseed&0x7FFFFFFF;
- }
- static int run(){
- int i,j,idx,m;
- int N,M,K,result;
- scanf("%d %d %d",&N,&M,&K);
- init(N,M,K);
- int piece[60];
- for(i=0;i<N*N+K;++i){
- for(j=0;j<4;++j){
- scanf("%d",&mseed);
- idx=j*M;
- piece[idx]=piece[idx+M-1]=0;
- if(mseed>0){
- for(m=1;m<M-1;++m)
- piece[idx+m]=pseudo_rand()%3-1;
- }else{
- mseed*=-1;
- for(m=M-2;m>0;--m)
- piece[idx+m]=1-pseudo_rand()%3;
- }
- }
- add_piece(piece);
- }
- result=find_center_piece();
- return result;
- }
- int main(int argc, char* argv[])
- {
- int tc,T;
- setbuf(stdout,NULL);
- freopen("20180624i.txt","r",stdin);
- scanf("%d",&T);
- for(tc=1;tc<=T;++tc)
- {
- printf("#%d %d\n",tc,run());
- }
- return 0;
- }
- /*
- 1
- 3 8 1
- 324558 198996 -104795 -31709
- 1443 122094 -15203 -67959
- 222569 376501 -127631 -54743
- 88597 51386 -648201 -395447
- 15203 54743 -324558 -579850
- 648201 268085 -355781 -376501
- 355781 74551 -297177 -249935
- 88597 80788 -617409 -395447
- 850670 395447 -222569 -122094
- 127631 249935 -303339 -198996
- */
- #include "stdafx.h"
- /*
- 3 <= N <= 49 odd number
- 8 <= M <= 18
- 1 <= K <= 5
- */
- int fn;
- int fm;
- int fk;
- short a_ps[2406][60];
- short mark[2406];
- void init(int N,int M,int K)
- {
- fn=N;
- fm=M;
- fk=K;
- }
- void add_piece(int piece[])
- {
- }
- int find_center_piece()
- {
- return 0;
- }
10-23 22:21