Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need a python code using dynamic programming to solve this problem with the limitations provided. the previuos solutions eaither to be examples of inputs/outputs, or

Need a python code using dynamic programming to solve this problem with the limitations provided.
the previuos solutions eaither to be examples of inputs/outputs, or incomplete python code because of long steps and explination, or not using dynamic programming !
image text in transcribed
input: standard input output: standard output The Computer Science department keeps getting larger, and our department has more and more undergraduate students and graduate students every year. Eventually, the department decided to partition CS 287; Colloquium in Computer Science, into two sections since otherwise no classroom is big enough for all students. Yihan is running CS 287 now. Yihan has lots of experience on running the colloquium. She categorized the speakers based on their research areas: theory. system, and Al. The students don't like to attend talks in the same category consecutively. More precisely, the students will consider this talk and the two previous talks (or fewer if there haven't been that many), and: - If they are in same category, students will only pay attention to the talk for 20 minutes. - If they are from two categories, students will pay attention to the talk for 40 minutes. - If they are all from three different categaries, students will pay aftention to the talk for the entire 60 minutes. Yihan has contacted n prominent computer scientists to give the talks. Of course, the speakers are busy, so they have committed s certain day to give the talk. Yihan knows the order, and her task is to determine which speaker should go to which section. The speakers do not like to give the same talk twice, so Yihan can only assign himvher to one of the sections. Input The first line contains an integer n(1n100,000). The second line contains a string consisting of n characters, indicating the speakers research areas in the order their taiks. Each character will be one of the uppercase letters ' T ' (for theory). ' S ' (for systern) or ' A ' (for A ). Output The output contains only one number, the total time (in minutes) that the students will pay attention to for both sections. The two sections can have different numbers of speakers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Rules In Database Systems Third International Workshop Rids 97 Sk Vde Sweden June 26 28 1997 Proceedings Lncs 1312

Authors: Andreas Geppert ,Mikael Berndtsson

1997th Edition

3540635165, 978-3540635161

More Books

Students also viewed these Databases questions