SlideShare uma empresa Scribd logo
1 de 9
Baixar para ler offline
プログラマ脳を鍛える会
AtCoder Beginner Contest 005
http://abc005.contest.atcoder.jp/
スケジュール
・問題回答A 5分
・問題回答B 5分
・問題回答C 10分
A問題
-おいしいたこ焼きの作り⽅-
⾼橋君はたこ焼き屋をはじめることにしました。
たこ焼きを1つ作るのに必要な⼩⻨粉の量xグラムと、⾼橋くんが今持っ
ている⼩⻨粉の量yグラムが与えられるので⾼橋くんが最⼤でいくつたこ
焼きを作れるか出⼒して下さい。
⼊⼒
たこ焼きを1つ作るのに必要な⼩⻨粉の量を表す整数x(1≦x≦100)と、⾼橋くんが今
持っている⼩⻨粉の量を表す整数y(1≦y≦100)が半⾓スペース区切りで与えられる。
出⼒
⾼橋くんが最⼤でいくつたこ焼きを作れるか出⼒して下さい。
B問題
-おいしいたこ焼きの⾷べ⽅-
⾼橋君は試作したたこ焼きを⾷べることにしました。
⾼橋君は熱々のたこ焼きが好きなので、できてすぐのたこ焼きから⾷べます
それぞれのたこ焼きが何秒前にできたかが与えられるので、⼀番できたての
たこ焼きが何秒前にできたか出⼒して下さい。
⼊⼒
・1⾏⽬にたこ焼きの個数を表す整数 N(1≦N≦100) が与えられます。
・続く N ⾏にはそれぞれのたこ焼きが何秒前にできたかを表す整数 Ti(1≦Ti≦100)
が与えられます。
出⼒
⼀番できたてのたこ焼きが何秒前にできたか出⼒して下さい。
B問題
-おいしいたこ焼きの⾷べ⽅-
C問題
-おいしいたこ焼きの売り⽅-
⾼橋君は、たこ焼きをどの順番で売るか悩んでいました。というのも、作り置
きされたたこ焼きは美味しくないとわかっているので、⾼橋君はそのようなた
こ焼きを売りたくないのですが、できたてばかり売ってしまうと売れるたこ焼
きの数が減ってしまいます。
また、お客さんを待たせてばかりだと、次第にお客さんが離れてしまうだろう
と⾼橋君は考えています。
そこで、彼は T 秒以内に作成されたたこ焼きを売り続けることで、お客さんを
捌ききれるかどうかを調べることにしました。
たこ焼きは A1、A2、…、AN 秒後に焼きあがります。
お客さんは B1、B2、…、BM 秒後にやってきます。
1 ⼈のお客さんに対して、たこ焼きを 1 つ売るとします。すべてのお客さんに
たこ焼きを売れるならyes、売れないならnoを出⼒して下さい。
⼊⼒
・1 ⾏⽬に、何秒以内のたこ焼きまで売るかを表す整数T(1≦T≦100)が与えられます。
・2 ⾏⽬に、⾼橋君が作成するたこ焼きの総数を表す整数N(1≦N≦100)が与えられます。
・3 ⾏⽬に、それぞれのたこ焼きが何秒後にできるかを表す整数 Ai(1≦Ai≦100、
A1≦A2≦…≦AN) が半⾓スペース区切りで N 個与えられます。
・4 ⾏⽬に、来店するお客さんの⼈数を表す整数M(1≦M≦100)が与えられます。
・5 ⾏⽬に、それぞれのお客さんが何秒後に来るかを表す整数 Bi(1≦Bi≦100、B1≦B2≦…
≦BM) が半⾓スペース区切りで M 個与えられます。
出⼒
すべてのお客さんにたこ焼きをすぐ売れるならyes、売れないならnoを出⼒して下さい。
ヒント
・実装の流れ
-M⼈に対して、たこ焼きが売れるかどうかループを回して判定を⾏う。
判定を⾏う
 ・N個のたこ焼きに対してループを回し、まだ売られていないもので、
T秒後以内に作られたものがあるかどうかを探す
-あれば、最も昔に作られたものを売る
-なければ、noを出⼒して終了
-全部売り切れればyesを出⼒する

Mais conteúdo relacionado

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

At corder005