codeforces-problem-673A


[Codeforces] 673A: Bear and Game – Cuongquach.com | Let’s learn some algorithm by ourselves and solve the problem “673A: Bear and Game ” on Codeforces Come on. My coding ability is limited, so I hope to receive better feedback as well as other solutions from you.

Title “673A: Bear and Game”

You go to the homework link Codeforces 673A below to see the full information.

Link: https://codeforces.com/problemset/problem/673/A

Input

The first line of the input contains one integer n (1 ≤ n≤ 90) – the number of interesting minutes.

The second line contains n integers tfirst,t2, …,tn (1 ≤tfirst<t2<...tn≤ 90), given in the increasing order.

Output

Print the number of minutes Limak will watch the game

Example 1:

Example 2:

My idea:

  • I loop the elements in the interest time array.
  • Subtract the previous value from the current element value, if it is greater than 15, then the character has watched over 15 minutes of frustration in the ball game.
    => Then will calculate the number of minutes considered in the match and break loop.
  • If the value is not greater than 15, skip to the next element values.
    + If Index value is 0 or final, then closing the match time is not boring.

Link code github solution: https://github.com/cuongquach/cq-algo-challenges/blob/main/codeforces/673A/python/main.py

Submit the solution on Codeforces problem 637A:

Source: https://cuongquach.com/

Previous articleVPC Reachability Analyzer – An AWS network connection debugging service

You are following the website “https://cuongquach.com/” which stores general knowledge and personal sharing about Network & Service System Administration, rebuilt under the foundation of own experience. me, Quach Chi Cuong. Hope you enjoy this place!

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *