Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
競技プログラミングで見るRubyの豊かさ
Search
haruguchi-yuma
August 24, 2024
1
44
競技プログラミングで見るRubyの豊かさ
haruguchi-yuma
August 24, 2024
Tweet
Share
More Decks by haruguchi-yuma
See All by haruguchi-yuma
fukuoka.rb 0x000回 LT資料
haruguchi
0
130
shikujiri-lt
haruguchi
0
1.4k
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
Designing for humans not robots
tammielis
249
25k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
How to train your dragon (web standard)
notwaldorf
88
5.7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
A Tale of Four Properties
chriscoyier
156
23k
Build The Right Thing And Hit Your Dates
maggiecrowley
32
2.4k
What's new in Ruby 2.0
geeforr
343
31k
Agile that works and the tools we love
rasmusluckow
327
21k
Transcript
!IBSVHVDIJ ڝٕϓϩάϥϛϯάͰݟΔ 3VCZͷ๛͔͞ େࡕ3VCZձٞɹ 4BU
!IBSVHVDIJ wגࣜձࣾӬγεςϜϚωδϝϯτ wڭһˠ8FCΤϯδχΞ wڝϓϩྺ
None
ڝϓϩ "U$PEFS ͱ
ೖྗˠग़ྗ ͳΜ͔͢Δ
ͨͱ͑
ͨͱ͑
ͨͱ͑
ͨͱ͑
None
None
None
ࠓͷ ɾ"U$PEFSͷௐ·ͨ͠ ɾͦͷத͔Βհ
େࣄʹ͍ͨ͠Ձ؍ Մಡੑ ֦ுੑ อकੑ
Մಡੑ ֦ுੑ อकੑ ಡΈʹ͘͘ ෳࡶͰ͘ ʹಛԽͨ͠ ίονʂʂ େࣄʹ͍ͨ͠Ձ؍
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@ ))ͷΛٻΊ͍ͨ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@ ))ͷΛٻΊ͍ͨ ೖྗྫ 42 3 ग़ྗྫ 39
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@ ))ͷΛٻΊ͍ͨ ೖྗྫ 42 3 ग़ྗྫ 39
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@ ))ͷΛٻΊ͍ͨ
ϙΠϯτ จࣈϦςϥϧ? joinͷΤΠϦΞε*
ϙΠϯτ จࣈϦςϥϧ? joinͷΤΠϦΞε*
ϙΠϯτ ίϚϯυͱ࣮ͯ͠ߦ evalͰअѱ͞Λԋग़
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@ ))ͷΛٻΊ͍ͨ ࠶ܝ ͬͱ͘ॻ͚ΔΑͱ͍͏ਓ͕͍ͨΒڭ͍͑ͯͩ͘͞
ͭͷ୯ޠ͕ۭന۠ΓͰ༩͑ΒΕΔɻ ֤୯ޠͷઌ಄Λͭͳ͛ɺେจࣈͰग़ྗ͍ͨ͠
ೖྗྫ atcoder beginner contest IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ͭͷ୯ޠ͕ۭന۠ΓͰ༩͑ΒΕΔɻ ֤୯ޠͷઌ಄Λͭͳ͛ɺେจࣈͰग़ྗ͍ͨ͠
ೖྗྫ atcoder beginner contest IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ͭͷ୯ޠ͕ۭന۠ΓͰ༩͑ΒΕΔɻ ֤୯ޠͷઌ಄Λͭͳ͛ɺେจࣈͰग़ྗ͍ͨ͠
ೖྗྫ atcoder beginner contest IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ͭͷ୯ޠ͕ۭന۠ΓͰ༩͑ΒΕΔɻ ֤୯ޠͷઌ಄Λͭͳ͛ɺେจࣈͰग़ྗ͍ͨ͠ ग़ྗྫ
ABC
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ͭͷ୯ޠ͕ۭന۠ΓͰ༩͑ΒΕΔɻ ֤୯ޠͷઌ಄Λͭͳ͛ɺେจࣈͰग़ྗ͍ͨ͠
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ͭͷ୯ޠ͕ۭന۠ΓͰ༩͑ΒΕΔɻ ֤୯ޠͷઌ಄Λͭͳ͛ɺେจࣈͰग़ྗ͍ͨ͠ ͏গ͘͠Ͱ͖ͦ͏ ಡΈʹ͘͘
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ͭͷ୯ޠ͕ۭന۠ΓͰ༩͑ΒΕΔɻ ֤୯ޠͷઌ಄Λͭͳ͛ɺେจࣈͰग़ྗ͍ͨ͠
ϙΠϯτ େจࣈͷมord
ϙΠϯτ େจࣈͷมord ڝϓϩͰكʹΑ͘͏ʂ
ϙΠϯτ ඪ४ग़ྗputc
" # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ೖྗྫ 9 AACCCACBB " # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 "
# $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B ೖྗྫ 9 AACCCACBB 123456789 ग़ྗྫ 8
" # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B " # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B " # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B " # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ indexʹ߹ܭCZUFͬͯΔʂʂ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B " # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B " # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ $_ ͕3ՕॴʹݱΕΔͷ
IUUQTBUDPEFSKQDPOUFTUTBCDUBTLTBCD@B " # $ͷΈ͔ΒͳΔ/จࣈͷจࣈྻ4 " # $͕ճҎ্ग़ݱ͢ΔͷԿจࣈʁ
ϙΠϯτ Regexp#~ $_ͱͷؒͰϚονΛͱΔ
ϙΠϯτ ΠϯΫϦϝϯτ bitస ୯߲ԋࢉ -
·ͱΊ·͢
·ͱΊ ɾ͍ΖΜͳॻ͖ํ͕Ͱ͖Δ ɾϝιουͷ๛͞ ɾ߈ུຊʹࡌͬͯͳ͍ॻ͖ํΛ୳ָ͢͠͞
3VCZJTGVO ,ZPQSPJTGVOTP UBLFUIFDIBMMFOHF