7 kyu

Simple Fun #225: Closest Neighbor

Description:

Task

Given a number n, find the largest integer below n and the smallest integer above n that are divisible by a, b, and c.

Input/Output

[input] integer n

A positive integer.

10 ≤ n ≤ 3 * 10^5

[input] integer a,b,c

1 ≤ a ≤ b ≤ c ≤ 100

[output] an integer array

Array of two integers, the first integer is the largest number less than n and divisible by a, b and c, and the second one is the smallest number greater than n and divisible by a, b ans c.

Example

For n = 20, a = 2, b = 3, c = 4, the output should be [12, 24]

Fundamentals

Stats:

CreatedApr 28, 2017
PublishedApr 28, 2017
Warriors Trained293
Total Skips4
Total Code Submissions416
Total Times Completed176
JavaScript Completions176
Total Stars4
% of votes with a positive feedback rating88% of 60
Total "Very Satisfied" Votes48
Total "Somewhat Satisfied" Votes10
Total "Not Satisfied" Votes2
Total Rank Assessments6
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • tachyonlabs Avatar
Ad