HDU--杭电--1195--Open the Lock--深搜--都用双向广搜,弱爆了,看题了没?语文没过关吧?暴力深搜难道我会害羞?

这个题我看了,都是推荐的神马双向广搜,难道这个深搜你们都木有发现?还是特意留个机会给我装逼?

Open the Lock

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3014    Accepted Submission(s): 1323

Problem Description
Now an emergent task for you is to open a password lock. The password is consisted of four digits. Each digit is numbered from 1 to 9.
Each time, you can add or minus 1 to any digit. When add 1 to '9', the digit will change to be '1' and when minus 1 to '1', the digit will change to be '9'. You can also exchange the digit with its neighbor. Each action will take one step.

Now your task is to use minimal steps to open the lock.

Note: The leftmost digit is not the neighbor of the rightmost digit.

 

 

Input
The input file begins with an integer T, indicating the number of test cases.

Each test case begins with a four digit N, indicating the initial state of the password lock. Then followed a line with anotther four dight M, indicating the password which can open the lock. There is one blank line after each test case.

 

 

Output
For each test case, print the minimal steps in one line.
 

 

Sample Input
2 1234 2144 1111 9999
 

 

Sample Output
2 4

 

 

 

 

);
        cout<<ss<<endl;

;
}

 

       是不是水题?不是你就抽我,我擦!

最后发泄一下,妹的都说马化腾坑爹,这题目也坑啊,说什么每个case后面都空一行,就是输入最后一句啊,本人英语不行,所以先是全部输出ss后用两个endl,擦,说我PE,然后我控制,第二个endl我加个if(t)这就是控制只有两个输出之间有空格,妹的还是PE,好吧,我一怒之下就冲向我那个把这个鸟题过了的兄弟,调出代码,输入...输出...输入...输出...最后他说,空行是自己输入的......................我晕倒....

上一篇:学习JQuery中文文档之map()函数和get()函数


下一篇:学习Python 新去处:Python 官方中文文档