E D R , A S I H C RSS

AKnight'sJourney (rev. 1.9)

AKnight's Journey

Describe AKnight'sJourney here

Source Code

#include <stdio.h>

char* GetPath(int k)
{
	switch(k){
		case 101:	return "A1";
		case 304:	return "A1C2A3B1D2B3C1A2C3D1B2D3";
		case 307:	return "A1B3D2F1G3E2G1F3E1G2E3C2A3B1C3A2C1D3B2D1F2";
		case 308:	return "A1B3C1A2C3D1B2D3E1G2E3C2A3B1D2F1H2F3G1E2G3H1F2H3";
		case 403:	return "A1B3C1A2B4C2A3B1C3A4B2C4";
		case 405:	return "A1B3C1A2B4D3E1C2D4E2C3A4B2D1E3C4A3B1D2E4";
		case 406:	return "A1B3C1A2B4C2D4E2F4D3E1F3D2B1A3C4B2A4C3E4F2D1E3F1";
		case 504:	return "A1B3A5C4D2B1A3B5D4C2B4A2C1D3C5A4B2D1C3D5";
		case 505:	return "A1B3A5C4A3B1D2E4C5A4B2D1C3B5D4E2C1A2B4D5E3C2E1D3E5";
		case 604:	return "A1B3A5C6D4B5D6C4D2B1A3C2B4A2C1D3B2D1C3D5B6A4C5A6";
		case 703:	return "A1B3C1A2C3B1A3C2B4A6C7B5A7C6A5B7C5A4B2C4B6";
		case 803:	return "A1B3C1A2B4C2A3B1C3A4B2C4A5B7C5A6B8C6A7B5C7A8B6C8";
		default:	return "impossible";
	}
}
int main()
{
	int i, n, p, q;

	scanf("%d", &n);
	for(i=1;i<=n;i++){
		scanf("%d %d", &p, &q);
		printf("Scenario #%d:\n%s\n\n", i, GetPath(p*100+q));
	}
	return 0;
}


/// C

A[30][30],P,Q,F=1,C[8][2]={{-1,-2},{1,-2},{-2,-1},{2,-1},{-2,1},{2,1},{-1,2},{1,2}},N;char B[99];
main(i,j,n){
	if(F)
		for(i=scanf("%d",&n);N=i<=n;main(1,1),printf("Scenario #%d:\n%s\n\n",i++,F?B:"impossible"),memset(A,0,3600))
			B[scanf("%d %d",&P,&Q)*P*Q]=F=0;
	else
		if(F|1>i|i>P|1>j|j>Q|A[i][j]);
		else{
			for(B[N*2-2]=j+64,B[N*2-1]=i+48,n=F=N==P*Q,A[i][j]=N++;n<8&&!F;main(i+C[n++][0],j+C[n][1]));
			A[i][j]-=--N;
		}
}

...


  • 음... 어디가 틀렸을까요 -정진경
  • 난데없이 억셉트가 되버렸다. -정진경
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:21
Processing time 0.0474 sec