Rubyで競技プログラミング(入門編)

26e1ba9a02729b2d6013604135221aae?s=47 yhara
September 10, 2016

 Rubyで競技プログラミング(入門編)

26e1ba9a02729b2d6013604135221aae?s=128

yhara

September 10, 2016
Tweet

Transcript

  1. RubyͰڝٕϓϩάϥϛϯά(ೖ໳ฤ) RubyKaigi 2016 Kyoto LT (2016-09-10) yhara (Yutaka Hara) RubyKaigi

    2016 Kyoto LT (2016-09-10) 1
  2. NaCl দߐຊࣾ AtCoderձ • ਫ༵18:00-20:00 • 4,5ਓͰ΍ͬͯΔ • ݴޠ͸ࣗ༝ (͍·ͷͱ͜ΖΈΜͳRuby)

    RubyKaigi 2016 Kyoto LT (2016-09-10) 2
  3. ڝٕϓϩάϥϛϯάͬͯʁ RubyKaigi 2016 Kyoto LT (2016-09-10) 3

  4. ϓϩάϥϛϯάίϯςετ RubyKaigi 2016 Kyoto LT (2016-09-10) 4

  5. ৚݅Λຬͨ͢ϓϩάϥϜΛɺ଎͘ɾ ਖ਼֬ʹهड़͢Δڝٕ RubyKaigi 2016 Kyoto LT (2016-09-10) 5

  6. C(++, #)ͱJava͚ͩ͡Όͳ͍ͷʁ RubyKaigi 2016 Kyoto LT (2016-09-10) 6

  7. RubyͰ΋ࢀՃͰ͖Δ RubyKaigi 2016 Kyoto LT (2016-09-10) 7

  8. • Sphere Online Judge • Aizu Online Judge • yukicoder

    • AtCoder ←ࠓ೔͸͜ΕΛ঺հ RubyKaigi 2016 Kyoto LT (2016-09-10) 8
  9. Ruby 2.3.0͕ೖͬͯΔ RubyKaigi 2016 Kyoto LT (2016-09-10) 9

  10. Կ͔Β΍Ε͹͍͍ͷʁ RubyKaigi 2016 Kyoto LT (2016-09-10) 10

  11. • AtCoder Grand Contest • AtCoder Regular Contest • AtCoder

    Beginner Contest • AtCoder Typical Contest RubyKaigi 2016 Kyoto LT (2016-09-10) 11
  12. ΍Βͳ͍ RubyKaigi 2016 Kyoto LT (2016-09-10) 12

  13. աڈ໰Λ΍Δ RubyKaigi 2016 Kyoto LT (2016-09-10) 13

  14. • ޷͖ͳͱ͖ʹͰ͖Δ • যΒͳͯ͘ࡁΉ RubyKaigi 2016 Kyoto LT (2016-09-10) 14

  15. • AtCoder Grand Contest • AtCoder Regular Contest • AtCoder

    Beginner Contest • AtCoder Typical Contest RubyKaigi 2016 Kyoto LT (2016-09-10) 15
  16. AtCoder Beginner Contest • A: ָউ • B: ؆୯ •

    C: ॳڃ • D: தڃ(΍Γͨ͑͋͝Δ) ※ճʹΑͬͯ೉қ౓ʹ͸ඍົͳ͕ࠩ͋Γ·͢(͍͖ͳΓ೉͍͠ճҾ͍ ͯ΋མͪࠐ·ͳ͍Α͏ʹ) RubyKaigi 2016 Kyoto LT (2016-09-10) 16
  17. Rubyͩͱ λΠϜΞ΢τ ͦ͠͏…ʁ RubyKaigi 2016 Kyoto LT (2016-09-10) 17

  18. ͦΕͳΓઓ͑Δ RubyKaigi 2016 Kyoto LT (2016-09-10) 18

  19. ΞϧΰϦζϜ͸େࣄ RubyKaigi 2016 Kyoto LT (2016-09-10) 19

  20. ྫɿҰྻΦηϩ (C໰୊) RubyKaigi 2016 Kyoto LT (2016-09-10) 20

  21. ҰྻΦηϩ • NݸͷۨͱɺQݸͷϨϯδ͕༩͑ΒΕΔ • ֤ൣғΛͻͬ͘Γฦͨ͠ͱ͖ͷ࠷ऴঢ়ଶΛٻΊΑ ••••••••• 1..4 2..6 8..9 ɹɹ↓

    ◦•••◦◦•◦◦ RubyKaigi 2016 Kyoto LT (2016-09-10) 21
  22. ֤ൣғʹ͍ͭͯۨΛ൓సͤ͞Ε͹͍͍͚ͩ͡ ΌͶʁ ranges.each do |r| r.each do |i| line[i] =

    !line[i] end end RubyKaigi 2016 Kyoto LT (2016-09-10) 22
  23. ͱ͜Ζ͕ RubyKaigi 2016 Kyoto LT (2016-09-10) 23

  24. • Φηϩ͕(࠷େ)20ສݸ͋Δ • ൣғ΋(࠷େ)20ສݸ͋Δ RubyKaigi 2016 Kyoto LT (2016-09-10) 24

  25. ਺ेԯճɺ൓స͠ͳ͍ͱ͍͚ͳ͍ ranges.each do |r| # <- 20ສճ r.each do |i|

    # <- ͦΕͧΕ਺ສճ͘Β͍ line[i] = !line[i] end end RubyKaigi 2016 Kyoto LT (2016-09-10) 25
  26. ⏰ ੍ݶ࣌ؒ͸2ඵ RubyKaigi 2016 Kyoto LT (2016-09-10) 26

  27. ͏·͍΍Γ͔ͨ ৭͕มΘΔͱ͜Ζ͚ͩΛ͓֮͑ͯ͘ 2 10001 23005 ↓ɹɹɹɹ↓ɹɹ↓ ◦••...•◦...◦••• RubyKaigi 2016 Kyoto

    LT (2016-09-10) 27
  28. ௨ͬͨʂ RubyKaigi 2016 Kyoto LT (2016-09-10) 28

  29. RubyͰ΋ڝϓϩͰ͖Δͧ ! (গͳ͘ͱ΋Beginner ContestͳΒ) RubyKaigi 2016 Kyoto LT (2016-09-10) 29

  30. ! ༨ஊ ! RubyKaigi 2016 Kyoto LT (2016-09-10) 30

  31. RubyKaigi 2016 Kyoto LT (2016-09-10) 31

  32. ABC037-D • 1000x1000ͷ໎࿏Λ୳ࡧ͢Δ໰୊ • νϟϨϯδϟʔٻΉ • Ruby3͸3ഒ଎͘ͳΔͱ͍͏ᷚͳͷͰ͖ͬͱ௨ΔΑ͏ʹͳΔ͸ ͣʁ RubyKaigi 2016

    Kyoto LT (2016-09-10) 32
  33. Crystalͩͱ௨Δ(͕͢͞) ※CrystalɿRubyʹΑ͘ࣅͨ੩తܕ෇͚ݴޠ RubyKaigi 2016 Kyoto LT (2016-09-10) 33

  34. pypy2΋௨ͬͯΔ ※pypy2ɿPythonॲཧܥͷҰͭ RubyKaigi 2016 Kyoto LT (2016-09-10) 34

  35. Python3!? RubyKaigi 2016 Kyoto LT (2016-09-10) 35

  36. RubyKaigi 2016 Kyoto LT (2016-09-10) 36

  37. RubyKaigi 2016 Kyoto LT (2016-09-10) 37

  38. RubyKaigi 2016 Kyoto LT (2016-09-10) 38

  39. (ྑ͍ࢠ͸ਅࣅ͠ͳ͍Α͏ʹ !) RubyKaigi 2016 Kyoto LT (2016-09-10) 39