Anshul, Usama And Punishment - B
Practice
2.8 (22 votes)
Easy
Problem
41% Success 3919 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Anshul and Usama are fond of games and devote most of their time playing them. On one hand Anshul likes to play outdoor games like football, cricket, etc whereas on the other hand Usama likes to play mobile games like Clash of Clans, Mini Militia, etc. One day their teacher decided to punish them. As punishment, their teacher sent them to a building and locked all the exit points of that building. After locking the exit points, their teacher informed them from outside that the only way to come out of the building was by solving a problem.

The problem he gave was that they will be given some initial terms of a series and they have to use the series and tell him the maximum value of (|Ai + Aj|+|Ai - Aj|) where Ai and Aj are some ith and jth term of the series with the condition 0 <= i,j < n. Also, 'i' can not be equal to 'j'.

The initial terms of the series are 20, 30, 40, 90, 80, 270,...

INPUT
The value of n= 62

OUTPUT
Output the maximum value of (|Ai + Aj|+|Ai - Aj|).

  • To see how to submit solution please check this link

Compile and Test can give Wrong Answer. Once you have written your answer, press Submit button to check your result.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
11 votes
Tags:
Ad-HocMathematicsOpenApprovedEasyMathamatics
Points:20
210 votes
Tags:
Basic ProgrammingSimple-mathEasy
Points:20
1 votes
Tags:
Easy