初学者でも遊べる!Rubyで競技プログラミング

 初学者でも遊べる!Rubyで競技プログラミング

Dd22f5a9a3a0c5d89f24322be74640a1?s=128

gogutan

June 27, 2020
Tweet

Transcript

  1. 9.
  2. 12.

    w "U$PEFSɹˠΦεεϝ✨
 IUUQTBUDPEFSKQ 
 ೔ຊͷίϯςεταΠτɺ΄΅ຖि຤։࠵ɺສਓ΄Ͳ͕ಉ࣌ࢀՃ w (PPHMF$PEF+BN
 IUUQTDPEJOHDPNQFUJUJPOTXJUIHPPHMFDPNDPEFKBN 
 (PPHMFओ࠵ɺ೥ʹ౓ͷେ͖ͳίϯςετ

    w 5PQDPEFS
 IUUQTBSFOBUPQDPEFSDPN 
 ΞϝϦΧͷ࿝ฮίϯςεταΠτ w $PEFGPSDFT
 IUUQTDPEFGPSDFTDPN 
 ϩγΞͷίϯςεταΠτɺ։࠵ස౓͕ߴ͘ࢀՃਓ਺΋ଟ͍ ओཁͳڝٕϓϩάϥϛϯάαΠτͷҰྫ
  3. 14.
  4. 15.
  5. 16.
  6. 17.
  7. 22.

    "U$PEFS#FHJOOFS$POUFTU#1PTUBM$PEF IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@C ग़୊ྫ ࣮૷ྫʢจࣈͣͭ֬ೝʣ def postal_code?(string, a, b) string.each_char.with_index do

    |char, index| case index when a return false unless char == “-" else return false unless (“0”.."9").include?(char) end end true end w ۭจࣈ͕ೖྗ͞Εͯ΋USVF͕ฦ͖ͬͯͯ͠·͏ w ਖ਼نදݱΛ࢖͑͹ɺ΋ͬͱ͍͍ײ͡ʹॻ͚ΔͷͰ͸ʁ
  8. 23.

    "U$PEFS#FHJOOFS$POUFTU#1PTUBM$PEF IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@C ग़୊ྫ ࣮૷ྫʢจࣈͣͭ֬ೝʣ def postal_code?(string, a, b) string.each_char.with_index do

    |char, index| case index when a return false unless char == “-" else return false unless (“0”.."9").include?(char) end end true end def postal_code?(string, a, b) string.match?(/\d{#{a}}-\d{#{b}}/) end w ۭจࣈ͕ೖྗ͞Εͯ΋USVF͕ฦ͖ͬͯͯ͠·͏ w ਖ਼نදݱΛ࢖͑͹ɺ΋ͬͱ͍͍ײ͡ʹॻ͚ΔͷͰ͸ʁ ࣮૷ྫʢਖ਼نදݱʣ ˠ؆͔ܿͭਖ਼֬ͳίʔυʹʂ