{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eYour favorite uncle has passed away, leaving you a large\n estate. Bank account numbers, locations of safe deposit boxes,\n and GPS coordinates to buried treasures are all locked in an\n electronic safe in your uncle’s office behind a picture of dogs\n playing poker. One day he showed you the safe with its\n \u003cspan class\u003d\"tex2jax_process\"\u003e$9$\u003c/span\u003e digit keypad (digits\n \u003cspan class\u003d\"tex2jax_process\"\u003e$1$\u003c/span\u003e through \u003cspan class\u003d\"tex2jax_process\"\u003e$9$\u003c/span\u003e). He told you he wasn’t worried\n about anyone breaking into his safe because it’s equipped with\n a self-destruct mechanism that will destroy the contents if\n anyone attempts a forced entry.\u003c/p\u003e\n \u003cp\u003eThe combination is a sequence of six decimal digits. If an\n incorrect combination is entered the safe enforces a\n thirty-second delay before accepting another combination. So a\n brute-force effort to try all six-digit combinations could take\n months.\u003c/p\u003e\n \u003cp\u003eYour uncle had planned to give you, his sole heir, the\n combination one day, but due to an unfortunate hang-gliding\n accident in Kansas, you now must rely on your deductive and\n programming skills to access the key to your inheritance.\u003c/p\u003e\n \u003cp\u003eHere’s what you know:\u003c/p\u003e\n \u003cul class\u003d\"itemize\"\u003e\n \u003cli\u003e\n \u003cp\u003eThe combination \u003cspan class\u003d\"tex2jax_process\"\u003e$c$\u003c/span\u003e\n is a sequence of six non-zero decimal digits.\u003c/p\u003e\n \u003c/li\u003e\n \u003cli\u003e\n \u003cp\u003eYour mother recalls that she heard your uncle mention\n that all the digits are different.\u003c/p\u003e\n \u003c/li\u003e\n \u003cli\u003e\n \u003cp\u003eYou remember that your uncle once said that the six\n digit number was divisible by each of its individual\n digits.\u003c/p\u003e\n \u003c/li\u003e\n \u003c/ul\u003e\n \u003cp\u003eAn example satisfying these conditions is \u003cspan class\u003d\"tex2jax_process\"\u003e$123864$\u003c/span\u003e: all six digits differ, and\n you can check that \u003cspan class\u003d\"tex2jax_process\"\u003e$123864$\u003c/span\u003e is divisible by each of\n \u003cspan class\u003d\"tex2jax_process\"\u003e$1$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$2$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$3$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$8$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$6$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$4$\u003c/span\u003e.\u003c/p\u003e\n \u003cp\u003eEven with the helpful data, it could take a while to get to\n open the safe, so the task is likely to be split into several\n sessions with separate ranges being tested. How many\n combinations are there to try in the range given?\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eThe input is a line with two space-separated integers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$L$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$H$\u003c/span\u003e, where \u003cspan class\u003d\"tex2jax_process\"\u003e$123\\, 456 \\leq L \u0026lt; H \\leq 987\\,\n 654$\u003c/span\u003e\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003ePrint one integer, the total number of possible combinations\n to the safe, where each combination \u003cspan class\u003d\"tex2jax_process\"\u003e$c$\u003c/span\u003e must satisfy the three constraints\n above, and lie in the range \u003cspan class\u003d\"tex2jax_process\"\u003e$L\n \\leq c \\leq H$\u003c/span\u003e.\u003c/p\u003e\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e123864 123865\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 2\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e198765 198769\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n \u003ch2\u003eSample 3\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e200000 300000\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e31\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}