Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя Jonis

Автор Jonis, 11 лет назад, По-английски

I need a hint to solve problem F (password remembering) at ICPC DHAKA 2009.

I have tried to solve this problem for several days unsuccessfully...

At this link you can get a description and some comments about the questions:

http://www.northsouth.edu/acm/dhaka2009.pdf

The link of the problem in Live Archive is:

https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=346&page=show_problem&problem=2499

I would appreciate any help. Thanks in advance!

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
11 лет назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

Hello,

I'm not sure if this is what you're looking for, but here is a solution in Python 2.7.5

It's not the most efficient solution xD But it worked for the sample problem

n=int(raw_input())

ab=[]

num=""
answers=[]


for i in xrange(n):
	ab.append(map(int, raw_input().split()))

for i in ab:
	ans=0
	for j in xrange(i[0],i[1]+1):
		num=str(j)[::-1]
		if(i[0] <= int(num) <= i[1]):
			ans+=1
	answers.append(ans)

blah=0

for i in answers:
	answernumber+=1
	print "Case "+str(answernumber)+": "+str(answers[answernumber-1])
  • »
    »
    11 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +6 Проголосовать: не нравится

    Thank you, but this is not what I was looking for, since the problem expects a logarithmic solution.

    I suggest you try A = 1 and B = 2**64 — 1.

    Unfortunatelly, this solution is too slow...

    Anyone have a better idea?

»
11 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Did you solve it? I did if you still asking for help