Codeforces Round #301 (Div. 2)

Revision en1, by laser-likefocus, 2015-09-10 16:51:15

I will try to make an excellent tutorial (easy to get the idea) for every A,B division 2 problem i solve ; that is the best way to help others as a Div2 guy.

540A - Кодовый замок The idea of the problem is simple enough to notice that to go from '2' to '8' there's only two possible solution(directions) : 1- 2-3-4-5-6-7-8 (forward) ---> abs(s1[i] — s2[i]) 2- 2-1-0-9-8 (backward) ---> 10 — abs(s1[i] — s2[i]) (same as : s1[i] — '0' + '9 — s2[i])

" Draw These two possible directions on a paper, to get the idea"

Then , take the minimum between the two and add them to your result counter. of course anything unclear or wrong , please ask me to handle it ASAP. Thanks :) .

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English laser-likefocus 2015-09-11 03:17:56 0 (published)
en2 English laser-likefocus 2015-09-10 17:34:37 2 Tiny change: '; s2[i])\n 2- 2-' - (saved to drafts)
en1 English laser-likefocus 2015-09-10 16:51:15 764 Initial revision (published)