Preparing NOJ

MOVE

2000ms 81920K

Description:

On a infinite plane,you are on the (0,0) at the beginning.
You have to move to (x,y).But you can only move by the give K ways.
I want you to give me the least steps you need to move to the destination.

For example
 If you have to go to (3,1) and you have 3 ways to move: (-1,1) (1,0)(3,1).you only need one (3,1) move to get to the destination.

There are more than one case in a single input.
I promise that you can get to the destination.

Input:

In the first there is a T,which means T cases;
In the first line there are 3 integers x y K   -100<x,y<100  k<=10
In the following K line ,each line has 2 integers xi,yi   -100<xi,yi<100;

Output:

One integer to show the minimum steps.

Sample Input:

1
1 1 1
1 1

Sample Output:

1

Note:

本题由旧版NOJ导入,来源:2E

Info

NOJ

Provider NOJ

Code NOJ1966

Tags

Submitted 1

Passed 1

AC Rate 100%

Date 04/20/2019 10:03:10

Related

Nothing Yet