1 / 11

Numpad

Numpad. 30th January, 2010. Statistics. #Max = 15 Mean (attempted) = 49.7 . How do you solve this question?. How long did you take?. >1hr? 45 min? 30 min? 20 min? 15 min? 10 min? 5 min? 1 min?. Aim. Test your programming skills if for Use of suitable data types char int

rossa
Download Presentation

Numpad

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Numpad 30th January, 2010

  2. Statistics • #Max = 15 • Mean (attempted) = 49.7

  3. How do you solve this question?

  4. How long did you take? • >1hr? • 45 min? • 30 min? • 20 min? • 15 min? • 10 min? • 5 min? • 1 min?

  5. Aim • Test your programming skills • if • for • Use of suitable data types • char • int • array • Carefulness • hardcode

  6. Observation • Decision does not depend on future presses • ‘Causal’ • Analyzing the sequence would not help • So we can just simulate!

  7. Skills • Reading the number • The question says ‘a positive integer N, which is less than 1030.’ • How do I know how large is the number? (When to stop input?) • while scanf()... • while cin >> • while not eoln do

  8. Use of data types • Array • What size? • How to access an array? • What index to use? • Char • How to convert to integer? • Integer

  9. Carefulness • If conditions • When to use the left zero / right zero? • How to determine the distance? • Formula? • Hardcode?

  10. Formula • Steps = Steps in horizontal direction (dx) + Steps in vertical direction (dy) • dx = abs(prev % 3 – cur % 3) • dy = abs((prev-1) \ 3 – (cur-1) \ 3) • Zero is left for you to think

  11. End

More Related