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
300
internship final presentation
kagamiz
0
1.4k
internship-middle term presentation
kagamiz
0
1.2k
すうがくのまほう
kagamiz
0
390
ご当地料理の紹介
kagamiz
0
500
オンラインジャッジシステムの実装
kagamiz
0
1.3k
AOJ 0022 Maximum Sum Sequence 解説
kagamiz
1
1.6k
AOJ 0557 A First Grader 解説
kagamiz
0
1k
JOI2013 本選1 Illumination 解説
kagamiz
0
430
Other Decks in Programming
See All in Programming
APNsからLive Activityを開始する話
yumnumm
0
160
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
770
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
34
16k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.3k
golang-bob.pdf
iwatsukayura
0
130
Agents on Rails - Rails at Scale 2026
irinanazarova
0
530
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.6k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
580
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
140
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
Domain-Driven Transformation
hschwentner
2
2.3k
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
230
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
210
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
400
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
320
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.7k
Mind Mapping
helmedeiros
1
400
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Side Projects
sachag
456
43k
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 さんの出題 )