Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
KOJ 0002 Extended FizzBuzz 解説
Search
kagamiz
March 29, 2013
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
KOJ 0002 Extended FizzBuzz 解説
OkNCT-ICT 2013 春合宿 Day 5 (らしい) で解説したもの.
kagamiz
March 29, 2013
More Decks by kagamiz
See All by kagamiz
KCS v2. の開発
kagamiz
0
290
internship final presentation
kagamiz
0
1.4k
internship-middle term presentation
kagamiz
0
1.2k
すうがくのまほう
kagamiz
0
390
ご当地料理の紹介
kagamiz
0
500
オンラインジャッジシステムの実装
kagamiz
0
1.2k
AOJ 0022 Maximum Sum Sequence 解説
kagamiz
1
1.6k
AOJ 0557 A First Grader 解説
kagamiz
0
1k
JOI2013 本選1 Illumination 解説
kagamiz
0
420
Other Decks in Programming
See All in Programming
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
420
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
320
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
320
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
5.7k
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
910
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
260
AIを上手に使っていこうとしたら越境せざるを得なくなった話 〜実践1年で見えた境界を越えなければならない理由と進め方〜 / Crossing borders with AI
tomoyakitaura
4
1.1k
typoなんかねぇよ
raspython3
0
680
ALB ログから Trace を気合で繋げる技術
fohte
7
880
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
450
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
520
Building AI with AI
inesmontani
PRO
1
1.2k
A better future with KSS
kneath
240
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
440
Designing Powerful Visuals for Engaging Learning
tmiket
1
540
Tell your own story through comics
letsgokoyo
1
1.1k
Code Reviewing Like a Champion
maltzj
528
40k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Transcript
KOJ 0002 Extended FizzBuzz 解説 @kagamiz
問題の概要 • 数字 N と発言 S が与えられます . • N
が 3 の倍数なら Fizz, 5 の倍数なら Buzz, 3 の倍数かつ 5 の倍数なら FizzBuzz と出力 . そうじゃなければ N を そのまま出力 . • S が上記の基準とおりなら YES, そうでなければ NO を出力 . • N 10^100 ≦
N 10^100 ≦ • int 型や long long 型 ,
__int64 型で整数を入力→死 • 文字列として N だったり S だったりを読み込もう .
文字列として入力できた (AA 略 ) • どうやって比較しよう (AA 略 ) •
if (N % 3 == 0) (AA 略 ) • Compile Error (AA 略 ) • ▂▅▇█▓▒░('ω') █▇▅▂ ░▒▓ うわああああ
倍数条件 • 数 x が 3 の倍数 <=> 数 x
の各桁の和が 3 の倍数 • 数 x が 5 の倍数 <=> 数 x が 5 か 0 で終わる • これを判定すれば良いのであった ( 完 )
Let's 実装 • 数 x が 3 の倍数 <=> 数
x の各桁の和が 3 の倍数 for ( すべての桁 ): S ← S + 桁 i if (S が 3 の倍数 ) 数 x は 3 の倍数 • 数 x が 5 の倍数 <=> 数 x が 5 か 0 で終わる if ( 最後の桁が 0 か 5) 数 x は 5 の倍数
ちなみに • この問題は , 合同式というものの性質を知っていれば , 倍数条件を考えずに任意の数 A と B
で同じ事が出来 ます . • 練習問題 => Extended Extended FizzBuzz (KOJ 0004) http://koj.cms.am/show.php?p=4 (japlj さんの出題 )