{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n鲁大师是一个富有而且nb的ACMer。他每天都会写代码赚取工资。他的工资会显示在鲁大师女朋友的手机上,分别记录的是这个月鲁大师写的代码总数量和总工资,如图:\n \u003cbr\u003e \n \u003ccenter\u003e \n \u003cimg style\u003d\"max-width:100%;\" SRC\u003d\"CDN_BASE_URL/f32d2055f66492453f5f281614c8c360?v\u003d1570601736\"\u003e \n \u003c/center\u003e \n \u003cbr\u003e鲁大师可以使用两个按钮记录自己的工资。按下第一行的按钮,会使第一行代码数量加一。保持单份代码工资不变,总价会相应增加。按下第一个按钮,数据会由(2,5)变成(5,7.5),但是屏幕只能显示整数位,后台还是以浮点数运算。所以屏幕会由上图变成:\n \u003cbr\u003e \n \u003ccenter\u003e \n \u003cimg style\u003d\"max-width:100%;\" SRC\u003d\"CDN_BASE_URL/35b6e3ae88a56af5e41fda58c0e33b4b?v\u003d1570601736\"\u003e \n \u003c/center\u003e \n \u003cbr\u003e按下第二行的按钮,会使第二行总工资加一(当然,这个时候代码单价也改变了),(5,7.5)-\u003e(5,8.5),重复强调,屏幕只能显示整数位。\n \u003cbr\u003e \n \u003ccenter\u003e \n \u003cimg style\u003d\"max-width:100%;\" SRC\u003d\"CDN_BASE_URL/ee78df5286a6b5ee78a68b7a83759e42?v\u003d1570601736\"\u003e \n \u003c/center\u003e \n \u003cbr\u003e现在初始状况如下图,两个数字都为1\n \u003cbr\u003e \n \u003ccenter\u003e \n \u003cimg style\u003d\"max-width:100%;\" SRC\u003d\"CDN_BASE_URL/b3724711c6f8f66b42bb157c5ef32dc5?v\u003d1570601736\"\u003e \n \u003c/center\u003e \n \u003cbr\u003e鲁大师女朋友期望看到画面是:\n \u003cbr\u003e \n \u003ccenter\u003e \n \u003cimg style\u003d\"max-width:100%;\" SRC\u003d\"CDN_BASE_URL/373de59b444908f48e1b8f3d176436ef?v\u003d1570601736\"\u003e \n \u003c/center\u003e \n \u003cbr\u003e给定x, y。\n \u003cbr\u003e请问,为了满足鲁大师女朋友的愿望,鲁大师最少要按多少次按钮?\n\u003c/div\u003e\n"}},{"title":"Input","value":{"format":"HTML","content":"题目有多组数据。\n\u003cbr\u003e每组数据占一行,包括两个整数x和y, x(1 \u0026lt;\u003d x \u0026lt;\u003d 10) and y(1 \u0026lt;\u003d y \u0026lt;\u003d 10 \n\u003csup\u003e9\u003c/sup\u003e) 中间以一个空格隔开,代表宗师母期望看到的数字x,y。"}},{"title":"Output","value":{"format":"HTML","content":"对于每组数据,输出宗老师按按钮的最小次数。如果无法达到宗师母的期望,输出-1。格式如样例。"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e1 1\n3 8\n9 31\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e0\n5\n11 \n \u003ci style\u003d\"font-size:1px\"\u003e \u003c/i\u003e\u003c/pre\u003e"}},{"title":"提示","value":{"format":"HTML","content":"\u003cpre\u003e\n对于第二组数据,有\n(1, 1) -\u0026gt; (1, 2) -\u0026gt; (2, 4) -\u0026gt; (2, 5) -\u0026gt; (3, 7.5) -\u0026gt; (3, 8.5)\n\n \n \u003c/pre\u003e"}}]}