联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2020-10-24 10:44

Problem 1. Pogo-Hopper

Description

Overus Park, a transportation manufacturer, and Jandias, an

electronics manufacturer, collaborated to launch the new PogoHopper.

They launched two kinds of Pogo-Hopper: 1) Fibo Pogo-Hopper

and 2) Seq Pogo-Hopper. These two Pogo-Hoppers can bounce

up when a user uses. Every time the user uses the Pogo-Hopper in

a row, the user can travel more distance. Details of how far the

Pogo-Hopper can travel are described below.

A. Fibo Pogo-Hopper

? For the first use, the user can travel 3 meters.

? For the second use, the user can travel 2 more meters. (Total 5 meters.)

? For the n-th (n > 2) use, the user can travel (n-2)th total traveled distance.

ex) When n=3, the user travels total 8 meters. When n=4, the user travels total 13 meters.

? Now you can know that the total distance of the Fibo Pogo-Hopper can travel follows

the Fibonacci sequence (3, 5, 8, 13, 21 …).

B. Seq Pogo-Hopper

? For the n-th use, the user can travel 3n-2 meters.

? ex) When n=4, the user travels total 24 meters (1+4+7+12).

For the both Pogo-Hoppers, when the user press the reset button, the distance that the PogoHopper

can travel will reset to n=1.

You bought both kinds of Pogo-Hoppers, and you want to travel total x meters with those PogoHoppers.

What you have to do is for given input x (meters), count how many combinations can be

made for given conditions (which given below).

1) Use only Fibo Pogo-Hopper with one reset

2) Use only Seq Pogo-Hopper with one reset

3) Use Fibo Pogo-Hopper first, and then use Seq Pogo-Hopper

ex) x = 13 (meters)

For condition 1, two combinations are possible.

Use the Fibo Pogo-Hopper 2 times to move 5m, then use 3 times to move 8m.

Use the Fibo Pogo-Hopper 3 times to move 8m, then use 2 times to move 5m.

(Use the Fibo Pogo-Hopper 4 times to move 13m is impossible, you should reset it once.)

For condition 2, two combinations are possible.

Use the Seq Pogo-Hopper 1 time to move 1m, then use 3 times to move 12m.

Use the Seq Pogo-Hopper 3 times to move 12m, then use 1 time to move 1m.

For condition 1, one combination is possible.

Use the Fibo Pogo-Hopper 3 times to move 8m, then use the Seq Pogo-Hopper 2 times

to move 5m.

Thus, total 5 combinations are possible. (Print only the total combination, refer ‘console

output’.)

Scoring Criteria

? 10 scores per test case. (Total Score = 100)

Console Output

Problem 2. STARBUGS (Number sequence queue)

Description

? Make a program for STARTBUGS that takes an order from one or more customers and

displays serving messages as in FCFS (First-Come-First-Serve).

? STARBUGS has below menus.

1. Americano 2. Latte 3. Caffe Mocha 4. Tea

? The program receives an order as a number sequence of the menu.

Ex) 1132: Two Americanos, and one caffe mocha, and one latte.

? 0(zero)s are used for separating customers.

Ex1) 442012: We have two customers. One orders two teas and one latte, and the other

orders one Americano and one latte.

Ex2) 4402012: We have three customers with various orders.

? You must implement two functions, checkOrder() and processQ().

? Int checkOrder(int queue)

? Description: Make sure the order input (number sequence) is appropriate. If it is

incorrect, it must be entered again.

? Input: An integer value queue. It is user-typed input representing an order. As

explained above, this number sequence should be consist of numbers only

between 1-4 (including 0 in the sequence is okay as it acts as separator). We

assume input number sequence (order) is a positive integer (bigger than 0 and

smaller than integer max value; <2,147,483,647).

? Output: An integer value len. Length of the order. It will be used in function

prcoessQ. Ex) If your input is 1230332, len is 7.

? void processQ(int queue, int order_len)

? Description: After taking an appropriate order input, extract each order from the

left-most digit(namely, de-queue from the number sequence queue) to the right

most one. For each extraction, increase the count of the corresponding menu.

? Input: Two integer values queue and order_len. The queue is an order you typed

which is confirmed as an appropriate one and order_len is return value of the

function checkOrder().

? Output: Print each customer’s order sequentially.

INPUT

Your order? : 1230232022

OUTPUT

Okay. please wait.(ret=10)

serv_queue: 1230232022

Thank you, Customer (1). Here is your Americano(1), Latte(1), Caffe Mocha(1), Tea(0).

Thank you, Customer (2). Here is your Americano(0), Latte(2), Caffe Mocha(1), Tea(0).

Thank you, Customer (3). Here is your Americano(0), Latte(2), Caffe Mocha(0), Tea(0).

Scoring Criteria

? 25 scores per test case. (Total Score = 100)

Problem 3. Earth

When we travel abroad, we need to think about the departure time and arrival time. There is a

time difference (the difference between time zones), so it is possible that the arrival time is earlier

than the departure time. For many reasons include the above case, it is important to check the

arrival time exactly. We want to calculate the arrival time including a season when we know the

departure time, departure position, and arrival position.

Most of the condition is the same as our actual Earth. But to simplify the calculation, we assume

some additional condition below:

Condition:

? [a, b] means range from a to b, inclusive (including a and b).

1. Position is given with latitude and longitude

A. Latitude

i. Integer in range [-89, -1] or [1, 89]

ii. Positive latitudes are for the northern hemisphere and negative latitudes are for

the southern one.

B. Longitude

i. Integer in range [-165, 165] with step 15 (-165, -150, -135, …, 150, 165)

ii. Each 15-degree difference of longitude cause a time gap of 1 hour

iii. International Date Line is a straight line at longitude 180 degree

2. Time consists of year, month, day, hour, and season

A. Year, month, day

i. Same as our earth (should consider leap year)

ii. Year is in range [1900, 2500]

B. Hour

i. Integer in range [0, 23]

C. Season

i. For the northern hemisphere,

1. Spring: [Start of March, End of May]

2. Summer: [Start of June, End of August]

3. Autumn: [Start of September, End of November]

4. Winter: [Start of December, End of February]

ii. Southern hemisphere is opposite to the northern one. (Spring to Autumn, Summer

to Winter, and vice versa)

3. Flight time

A. Unit is the hour

B. Integer in range [0, 7200]

Input:

At the first line, the latitude and longitude of departure position d_lat and d_lon are given, separated

by one space.

At the second line, the year, month, day, and hour of the departure time d_year, d_month, d_day,

d_hour are given, separated by one space.

At the third line, the flight time in hours f_time is given.

At the fourth line, the latitude and longitude of arrival position a_lat and a_lon are given.

Input restriction: (all the input match this restriction is guaranteed)

? All input is integer value without unit

? d_lat, d_lon, d_year, d_month, d_day, d_hour, f_time, a_lat, a_lon follows the above condition

For example, the input is like below.

Output:

Print the arrival time with season, following the below format:

Arrive at YYYY/MM/DD H o’clock, and it is the SEASON.

YYYY is arrival year with four digits with leading zeros, MM is arrival month with two digits with

leading zeros, DD is arrival date with two digits with leading zeros, H is arrival hour with 24 hour

format(0 to 23) without leading zero. SEASON is the season of the arrival position at arrival time,

and should be one of ‘spring’, ‘summer’, ‘autumn’, and ‘winter’.

For example, you should print like below.

Arrive at 2020/07/01 6 o’clock, and it is the winter.

Arrive at 2500/09/14 18 o’clock, and it is the autumn.

Arrive at 1996/02/29 0 o’clock, and it is the spring.

Run Example:

Output Arrive at 2000/05/10 6 o’clock, and it is the spring.

Execution

In this case, think about the case the flight from Seoul, Korea to Los Angeles. Seoul is at +37

degrees latitude and +135 degrees longitude, and Los Angeles is at +34 degrees latitude and -120

degrees longitude. And the total flight times is 13 hours.

Let us think about the time of the departure at Los Angeles first. The difference of longitude is -

255 degree; it means time gap is -255 / 15 = - 17 hours. Therefore, the time of Los Angeles when

the airplane departure is 2000/05/09 17 o’clock while Seoul is 2000/05/10 10 o’clock.

Then when the airplane arrives in Los Angeles, it will be 13 hours which is total flight time. Adding

13 hours to 2000/05/09 17 o’clock, it will be 2000/05/10 6 o’clock. Los Angeles is in the northern

hemisphere and it is May, the season is spring. Therefore, we should print “Arrive at 2000/05/10 6

o’clock, and it is the spring.”

Example 2:

Output Arrive at 2020/03/03 0 o'clock, and it is the spring.

Execution

In this case, think about the case of the flight just staying in Seoul for 74 hours. Seoul is at +37

degrees latitude and +135 degrees longitude. We should figure out the time after 74 hours from

2020/02/28 22 o’clock. Keep in mind that 2020 is a leap year, so the last date of February is 29, not

28.

24 hours later will be February 29 22:00, 48 hours later is March 1 22:00, 72 hours later is March

2 22:00, 74 hours later is March 3 0:00. And it is the northern hemisphere and in March, the season

will be spring. Therefore, we should print “Arrive at 2020/03/03 0 o’clock, and it is the spring.”


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp