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

0MS程序

Posted by wm3418925 at 2015-08-27 11:41:47 on Problem 2243
#include<stdio.h>

static const char dfs8[] = 
"0323234534123434214323453232343423234345343434544343454554545456"
"3032323423212343121432342323234332323434434343453434345445454545"
"2303232312321234412143233232323423232343343434344343434554545454"
"3230323221232123341214322323232332323234434343433434343445454545"
"2323032332123212234121433232323243232323343434344343434354545454"
"3232303243212321323412144323232334323232434343435434343445454545"
"4323230334321232432341213432323243432323543434344543434354545454"
"5432323043432143543234124343232354343232454343435454343465454545"
"3212343403232345321234342143234532323434232343453434345443434545"
"4321234330323234232123431214323423232343323234344343434534343454"
"1232123423032323123212344121432332323234232323433434343443434345"
"2123212332303232212321233412143223232323323232344343434334343434"
"3212321223230323321232122341214332323232432323233434343443434343"
"4321232132323032432123213234121443232323343232324343434354343434"
"3432123443232303343212324323412134323232434323235434343445434343"
"4343212354323230434321235432341243432323543432324543434354543434"
"2143234532123434032323453212343421432345323234342323434534343454"
"1214323423212343303232342321234312143234232323433232343443434345"
"4121432312321234230323231232123441214323323232342323234334343434"
"3412143221232123323032322123212334121432232323233232323443434343"
"2341214332123212232303233212321223412143323232324323232334343434"
"3234121443212321323230324321232132341214432323233432323243434343"
"4323412134321232432323033432123243234121343232324343232354343434"
"5432341243432123543232304343212354323412434323235434323245434343"
"3232343421432345321234340323234532123434214323453232343423234345"
"2323234312143234232123433032323423212343121432342323234332323434"
"3232323441214323123212342303232312321234412143233232323423232343"
"2323232334121432212321233230323221232123341214322323232332323234"
"3232323223412143321232122323032332123212234121433232323243232323"
"4323232332341214432123213232303243212321323412144323232334323232"
"3432323243234121343212324323230334321232432341213432323243432323"
"4343232354323412434321235432323043432123543234124343232354343232"
"2323434532323434214323453212343403232345321234342143234532323434"
"3232343423232343121432342321234330323234232123431214323423232343"
"2323234332323234412143231232123423032323123212344121432332323234"
"3232323423232323341214322123212332303232212321233412143223232323"
"4323232332323232234121433212321223230323321232122341214332323232"
"3432323243232323323412144321232132323032432123213234121443232323"
"4343232334323232432341213432123243232303343212324323412134323232"
"5434323243432323543234124343212354323230434321235432341243432323"
"3434345423234345323234342143234532123434032323453212343421432345"
"4343434532323434232323431214323423212343303232342321234312143234"
"3434343423232343323232344121432312321234230323231232123441214323"
"4343434332323234232323233412143221232123323032322123212334121432"
"3434343443232323323232322341214332123212232303233212321223412143"
"4343434334323232432323233234121443212321323230324321232132341214"
"5434343443432323343232324323412134321232432323033432123243234121"
"4543434354343232434323235432341243432123543232304343212354323412"
"4343454534343454232343453232343421432345321234340323234532123434"
"3434345443434345323234342323234312143234232123433032323443212343"
"4343434534343434232323433232323441214323123212342303232312321234"
"3434343443434343323232342323232334121432212321233230323221232123"
"4343434334343434432323233232323223412143321232122323032332123212"
"5434343443434343343232324323232332341214432123213232303243212321"
"4543434354343434434323233432323243234121343212324323230334321234"
"5454343445434343543432324343232354323412434321235432323043432123"
"5454545643434545343434542323434532323434214323453412343403232345"
"4545454534343454434343453232343423232343121432342321234330323234"
"5454545443434345343434342323234332323234412143231232123423032323"
"4545454534343434434343433232323423232323341214322123212332303232"
"5454545443434343343434344323232332323232234121433212321223230323"
"4545454554343434434343433432323243232323323412144321232132323032"
"5454545445434343543434344343232334323232432341213432123243232303"
"6545454554543434454343435434323243432323543234124343214354323230"
;

#define get_my_dfs(i, j, ii, jj) dfs8[(i<<9)|(j<<6)|(ii<<3)|jj]

int main()
{
	char str[] = "To get from a1 to c8 takes 1 knight moves.";
	char line[16];
	int start_x,start_y;
	int end_x,end_y;
	
	while (1)
	{
		if (NULL == gets(line)) break;
		
		start_x = line[0]-'a';
		start_y = line[1]-'1';
		end_x = line[3]-'a';
		end_y = line[4]-'1';
		
		//str[12] = line[0]; str[13] = line[1];
		*((short *)(str+12)) = *((short *)(line));
		
		str[18] = line[3]; str[19] = line[4];
		//*((short *)(str+18)) = *((short *)(line+3));
		
		str[27] = get_my_dfs(start_x, start_y, end_x, end_y);
		
		puts(str);
	}
	
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator