We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Manasa and Stones
Manasa and Stones
Sort by
recency
|
964 Discussions
|
Please Login in order to post a comment
This is such a needlessly confusing problem. Here are some corrections/clarifications for those that might be confused:
This part is very misleading. "Differ" makes it sound like the values can either increase or decrease from one stone to the next, but they only increase.
This is just completely wrong. Actually, n is the total number of stones, including the zero stone.
Take special note of this. The input format is very confusing because each test case can actually be multiple test cases.
import java.io.; import java.util.; import java.util.stream.*;
class Result {
}
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
}
C++ ans
vector stones(int n, int a, int b) { if (n <= 1) { return {0}; }
}
My solution in C language :
The solution here is to use the absolute difference between the two differences to increment the initial value (0 + (smallest_value_between_a_and_b * (n-1))) until you reach the expected number of stones (initial value is the first stone).