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

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,好吧,我一怒之下就冲向我那个把这个鸟题过了的兄弟,调出代码,输入...输出...输入...输出...最后他说,空行是自己输入的......................我晕倒....

最新文章

  1. 【无私分享:ASP.NET CORE 项目实战(第十章)】发布项目到 Linux 上运行 Core 项目
  2. DEV word文档转换为pdf文件
  3. php empty函数
  4. /bin/dd if=/path/to/source-file of=/path/to/backup-file
  5. python解析xml模块封装代码
  6. Codeforces Round #362 (Div. 2)-&gt;B. Barnicle
  7. wap手机端解决返回上一页,js
  8. Visual Studio统计有效代码行数
  9. jquery 模态窗口 蒙层无法覆盖flash解决办法
  10. java_final修饰符
  11. brk(), sbrk() 用法详解
  12. 【spring源码分析】IOC容器初始化(十二)
  13. Linux 的系统目录介绍
  14. 编译安装php-7.1.17及部分扩展
  15. CSS魔法(一) 盒子模型
  16. JS高级 - 面向对象4(json方式面向对象)
  17. Java执行js代码
  18. 利用hadoop来解决“共同好友”的问题
  19. PCL行人检测
  20. 看视频 shell入门视频补充的 shell脚本基本知识(TMD有点乱)

热门文章

  1. Unity手撸2048小游戏——自动生成4*4棋盘
  2. 2.用vs2015创建Dotnet Core的mvc项目
  3. 获取div或者元素相对于屏幕坐上角的绝对位置
  4. Cocos2d-x 核心概念 - Node(节点)与Node层级架构
  5. 虚拟centos7 用ssh登录
  6. physx之刚体运动
  7. Servlet实现简单CRUD
  8. 使用JavaMail实现发送邮件功能
  9. medoo–高效的轻量级PHP数据库操作类
  10. CSS3--box-shadow