calloc's blog

By calloc, history, 5 weeks ago, In English

I'm intrested in how to learn to do all those math problems, since I didn't really follow math in most of middle school and most of the high school, I lack a lot of concepts plus education was pretty bad, with most proffesors not explaining well. I find myself discouraged whenever such problems arise, so I would like to know is it me, or I should learn some concepts. IF so what?

  • Vote: I like it
  • -2
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

colin galen's youtube channel

»
5 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

In math/math related problems you mostly encounter algebraic, rarely geometric concepts. First of all, you have to be familiar with number theory, know how numbers operate, be used in functions, how they get canceled in some cases. It's advised to know some basic formulas as $$$(a+b)^2=a^2+2ab+b^2$$$. And it's easier if you divide a task into subtasks.

Example problem: You are given an array $$$a$$$ of $$$n$$$ integers. You have to find some integer $$$m$$$, so that $$$f(m)$$$ is maximised, where $$$f(m)=(m\ mod\ a_1)\ +\ (m\ mod\ a_2)\ +\ ...\ +\ (m\ mod\ a_n)$$$

You start out simple, what is the maximum value of $$$m\ mod\ a_i$$$? It's $$$a_i-1$$$, when you set $$$m$$$ to some $$$a_i \times k - 1$$$, where $$$k$$$ is an integer

Furthermore, can you choose such $$$m$$$, that $$$m\ mod\ a_i$$$ is maximised for all $$$i$$$? Turns out yes! If you multiple all elements of the array and subtract one, so $$$m=a_1 \times a_2 \times ... \times a_n-1$$$ (However there is a simpler solution, where $$$m=-1$$$), and for every $$$i$$$, $$$m\ mod\ a_i$$$ is maximised

Lastly, when you fully done and understood the problem, you can cancel out unnecessary things, and the remaining part is to implement. In this problems case, the final answer is $$$sum(a)-len(a)$$$

Of course all problemsetters tend to hide the answer in testcases, where they give weird examples, so it's almost impossible to find any pattern fast. So, it's easier to check cases by hand and hopefully be able to recognise a consistent rule, pattern, working for all cases.

If you struggle with basic math concepts, then you could look for courses in any online resource, after all, internet is a free-source library, where you can find almost anything. Don't know/understand something? Google it!

I hope this one was helpful

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    it felt good to read , sir !

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank you so much for taking your time to answer this. I really like your problem and explanation of it.

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

If you're lacking mathematical maturity then I'd say picking a discrete maths book and working through it will be beneficial in the long term. If you have to you should review your school math textbooks and re-learn it (no shortcuts here if you're lacking those foundations).

»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I think math in CP is basically practical and common sense math which you get to learn by solving random problems