시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 256 MB 97 24 10 45.455%

문제

양의 정수 N의 자리곱은 N의 모든 자리를 곱한 것이다. 예를 들어, 2612의 자리곱은 2×6×1×2 = 24 이다.

어떤 수 N의 자기곱은 N과 N의 자리곱을 곱한 수이다. 예를 들어, 2612의 자기곱은 2612×24 = 62688이다.

두 양의 정수 A와 B가 주어졌을 때, 자기곱이 A보다 크거나 같고, B보다 작거나 같은 양의 정수의 개수를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 두 정수 A와 B가 주어진다. (1 ≤ A ≤ B < 1018)

출력

자기곱이 A보다 크거나 같고, B보다 작거나 같은 양의 정수의 개수를 출력한다.

예제 입력 1

145 192

예제 출력 1

4

예제 입력 2

20 30

예제 출력 2

2

예제 입력 3

2224222 2224222

예제 출력 3

1

힌트

19, 24, 32, 41의 자기곱은 171, 192, 192, 164 이다.

W3sicHJvYmxlbV9pZCI6IjI5NzQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM3OTBcdWFlMzBcdWFjZjEiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzU5MVx1Yzc1OCBcdWM4MTVcdWMyMTggTlx1Yzc1OCBcdWM3OTBcdWI5YWNcdWFjZjFcdWM3NDAgTlx1Yzc1OCBcdWJhYThcdWI0ZTAgXHVjNzkwXHViOWFjXHViOTdjIFx1YWNmMVx1ZDU1YyBcdWFjODNcdWM3NzRcdWIyZTQuIFx1YzYwOFx1Yjk3YyBcdWI0ZTRcdWM1YjQsIDI2MTJcdWM3NTggXHVjNzkwXHViOWFjXHVhY2YxXHVjNzQwIDImdGltZXM7NiZ0aW1lczsxJnRpbWVzOzIgPSAyNCBcdWM3NzRcdWIyZTQuPFwvcD5cclxuXHJcbjxwPlx1YzViNFx1YjVhNCBcdWMyMTggTlx1Yzc1OCBcdWM3OTBcdWFlMzBcdWFjZjFcdWM3NDAgTlx1YWNmYyZuYnNwO05cdWM3NTggXHVjNzkwX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