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

Re:这题怎么节省时间,我按照经典的叉积方法实现,却用了500多ms,请问15ms的是怎么搞的?

Posted by zouyu9631 at 2006-08-23 22:55:04 on Problem 1654
In Reply To:这题怎么节省时间,我按照经典的叉积方法实现,却用了500多ms,请问15ms的是怎么搞的? Posted by:liyineng at 2006-07-30 12:14:45
> 这题怎么节省时间,我按照经典的叉积方法实现,却用了500多ms,请问15ms的是怎么搞的?

同问!!!!

下面的写法还能优化么?

		scanf("%c", &dir);
		switch(dir)
		{
			case '1':nx = lx-1; ny = ly-1;break;
			case '2':nx = lx;   ny = ly-1;break;
			case '3':nx = lx+1; ny = ly-1;break;
			case '4':nx = lx-1; ny = ly;break;
			case '5':break;
			case '6':nx = lx+1; ny = ly;break;
			case '7':nx = lx-1; ny = ly+1;break;
			case '8':nx = lx;   ny = ly+1;break;
			case '9':nx = lx+1; ny = ly+1;break;
		}
		res += nx*ly-lx*ny;
		lx = nx; ly = ny;
		if(dir == '5')
			break;

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