简单的模拟题,如果是要找周期性的话,真不会啊~....
/*
ID:sevenst4
LANG:C++
PROG:ttwo
*/
#include<stdio.h>
using namespace std;char map[20][20];
void rotate( int &x,int &y )
{int tx,ty;tx=x;ty=y;x=ty;y=-tx;
}int main()
{freopen( "ttwo.in","r",stdin );freopen( "ttwo.out","w",stdout );int xf,yf,xc,yc;for( int i=1;i<=10;i++ ){scanf( "%s",map[i]+1 );for( int j=1;j<=10;j++ ){if( map[i][j]=='F' ){xf=i,yf=j;}if( map[i][j]=='C' ){xc=i,yc=j;}}}for( int i=0;i<12;i++ )map[0][i]=map[i][0]=map[11][i]=map[i][11]='*';int step=0;int cx,cy,fx,fy;cx=fx=-1;cy=fy=0;while( step<1000000 ){if( map[xc+cx][yc+cy]=='*' ){ rotate(cx,cy); }else{ xc+=cx;yc+=cy; }if( map[xf+fx][yf+fy]=='*' ){ rotate(fx,fy); }else{ xf+=fx;yf+=fy; }step++;if( xc==xf && yc==yf )break;}if( step<1000000 )printf( "%d\n",step );elseprintf( "0\n" );return 0;
}