[Java] Solving M-SOLUTIONS Procon Open 2020 in java

2 minute read

M-SOLUTIONS Procon Open 2020 Thank you for your hard work! Official page

The code I wrote this time is here The result was AC up to A-D. It was 4 questions AC, but I struggled with problem D…

Below is a brief explanation.

Problem A

The problem of how many conditions are required for a specific score. You can just use an if statement as it is, but if you look closely it will be separated by 200 points, It can be easily calculated by dividing the score by 200 and subtracting the remainder from 10.

Problem B

Given three numbers, double the number within K times Red numbers <Green numbers <Blue numbers…(Condition *) The question of whether you can.

Since the number was 7 or less, I simply counted the number of operations to satisfy the condition * and compared it with K and answered.

Problem C

The test score is given by the latest K times of multiplication, and it is a problem to judge whether the test score has risen. Even though it is the latest K multiplications, K-1 of the K multiplications is common.

A × B × C × D \\
B x C x D x E

In the case of the above figure, you can compare A and E.

Problem D

The issue of how much profit can be given given fluctuations in stock prices. I am not confident in how to solve it, but since it took 80 days, I solved it steadily.

  • Find local minimum of stock price
  • Buy stock price with the amount you have
  • Find the local maximum of the stock price
  • Sell off any stock you have

I made a loop with a while statement.

I also changed to long because it became WA due to overflow. I didn’t realize that it would overflow.

Problem E

I didn’t read the question because the percentage of correct answers was low…

Problem F

The constraint of 200000 is impossible! I could solve it if the amount of calculation was N^2.


Impressions

I was able to participate after a long time. .. After all it is fun. The rating is 978 → 967, and it seems that there is a lack of support …I want to regain 1000 next time :cry:

It’s a shame that the E problem was difficult, but the speed up to the D problem was not good enough,

Thank you for reading to the end!