0% found this document useful (0 votes)
60 views5 pages

Anime Purchase Optimization Program

The document provides instructions for an exercise to simulate purchasing anime items over multiple days given fluctuating currency exchange rates. The objective is to purchase items at the lowest exchange rate for K consecutive days, or to continue purchasing if M days pass without a purchase. All items must be purchased within N days. Input files provide a list of anime items and prices, and daily exchange rates over N days. The output should be the total expense. Programs must run in under 1 second for large input sizes to receive full marks.

Uploaded by

EladAquino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views5 pages

Anime Purchase Optimization Program

The document provides instructions for an exercise to simulate purchasing anime items over multiple days given fluctuating currency exchange rates. The objective is to purchase items at the lowest exchange rate for K consecutive days, or to continue purchasing if M days pass without a purchase. All items must be purchased within N days. Input files provide a list of anime items and prices, and daily exchange rates over N days. The output should be the total expense. Programs must run in under 1 second for large input sizes to receive full marks.

Uploaded by

EladAquino
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

February 25, 2020

EEE 121 (Limjoco, 2s1920) Machine Exercise 2

Linear Data Structures

Objectives:

- To decompose a simplified real world problem into subproblems

- To determine the appropriate data structure/s to efficiently solve the problem

- To implement a program that solves the problem in an adequate amount of time


given large input data

Background:

Currency exchange rates change daily due to several reasons such as politics, natural
disasters, and international relations. As such, there are times when the exchange rate
is beneficial to you, and other times when it is not.

In this exercise, you will play the role of a secluded anime addict determined to support
the growth of the anime industry in the western world, but you aim to spend as little as
you can for your anime related purchases given some constraints.

You are to purchase one item in your list at any given time when the exchange rate is at
its lowest for K consecutive days. However, as you cannot wait too long, if you have
not purchased anything in M days, you will be purchasing the next unpurchased item
on your list regardless of the exchange rates. If you have not purchased everything in
your list within N days, you will purchase them all on the last day. Your program must
run in under 1 second (assuming a 2.0-3.0GHz core) for an input size N = 1000000.

Specifications:

You are given a list of things to buy stored in a text file named [Link]. You
are also given the parameters in another text file [Link]. The file [Link]
has the following format:

N

K

M

n1

n2

…

nN


1
February 25, 2020

Each line of [Link] has the following format:

<anime title with any character except whitespace> <price>

Note that there can be any number of lines in [Link], but it is guaranteed
that there is at least one entry, and all the lines follow the line format.

Sample Input:

[Link]

Re-zero kara hajimeru isekai seikatsu 29

Boku dake ga inai machi 19

Ishuzoku Reviewers 69

Kara no kyoukai 99

Fate Zero 59

Kono subarashii sekai no shukufuku wo 79

Isekai Smartphone 9

[Link]

60

10

14

54.94

51.16

51.1

47.5

46.03

45.2

48

51.6

50.93

2
February 25, 2020
54.2

54.3

44.04

50.75

53

51.09

45.24

45.35

44.91

52.76

53.46

53.01

48.36

49.54

53.76

48.46

45.16

47.02

47.78

49.87

47.51

47.33

47.15

53.59

46.99

54.78

3
February 25, 2020
49.67

47.68

45.76

53.17

46.12

45.83

54.46

46.19

50.1

49.73

45.78

51.98

45.31

50.07

52.75

47.62

49.44

50.58

46.05

52.67

51.37

48.85

52.47

50.19

44.49


4
February 25, 2020
Sample Output:

16318.36

Testing and checking:

Input large number of exchange rates, output total expense.

The grading system is as follows:



20% Read content of [Link] and [Link]

30% Generate lowest exchange rate streak for each day

30% Calculate total expenses

20% Program runs in less than 1 second

—

100% Total

Submission and Deadline:

Submit your .cpp file in your section’s ME2 Submission Bin folder on or before March
06, 2020 11:59PM for the soft deadline. The hard deadline (with deductions) is on
March 20, 2020 11:59PM. Name your .cpp file as Lastname_Section_ME2.cpp.
Noncompliance on the file name will result in a 5% (or 5pt) deduction.

You might also like