Explaination for SEAND2

can anybody tell me that what is:-

(A (mod b[i]))

i don’t understand what mod is it? please explain.

1 Like

a%b means subracting b as many times from a until a becomes less than b.
In other words a%b gives you the remainder when a is divided by b.
Example - 10%3 is equal 1. 10 divided by 3 gives you 1 as the remainder.

2 Likes

According the problem, our goal is the minimize the sum of the remainders. So can you explain why the answer for the second test case is 754312 which results in remainder of 2. If the answer were 754321, then the remainder would be 1 which is smaller.

this is so because the output provided is not the best solution you can have many solutions for a single test case.

1 Like

@sampritipanda Even i have that doubt.
@bhagatdivesh12 can you upvote the answer?

@abeyaar i had done to do so but it is saying that i don’t have enough reputation to do so.

1 Like

@bhagatdivesh12 I didn’t get your explanation. could you please give me some more comments?

The question says, you are given some number A lets say 123. We have to find the permutation(which can be 213,312, 321,231 or 123 also) of this number which gives minimum mod value with B[i]. The given test case illustrates only one possible permutation. 754312 results in the remainder 2, this is one of the possible solution, not the best one which is 754321. It’s not that the given test case gives you the best answer, but yes, it gives one of the possible answers. Based on the criteria specified, 754312 will fetch you some marks, but the best score will be gained by 754321.

2 Likes

@damn_me Thanks for your reply. I get it.

Could you please give me some hints to solve this problem? lets share ideas here…

No… -_- Why would you do that?!

No! Asking for hint is against the rules - read guidelines and CoC