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
57
競技プログラミングで見る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.5k
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Adopting Sorbet at Scale
ufuk
73
9.1k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Typedesign – Prime Four
hannesfritz
40
2.4k
The Cost Of JavaScript in 2023
addyosmani
46
7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Visualization
eitanlees
146
15k
Building Applications with DynamoDB
mza
91
6.1k
Documentation Writing (for coders)
carmenintech
66
4.5k
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