AtCoder Beginner Contest 150 Thank you for your hard work! Official page
Unfortunately it's Unrated again ...
To commemorate the creation of my GitHub.com account, I also committed the AtCoder code I started a while ago after the contest was over. Here In addition, I will write a commentary article.
For the first time in competitive programming, I can only write about java as a language, so I use java. (Why are there so many people using Python or C in competition pros ...)
The problem of multiplying and comparing. I don't think any explanation is necessary.
The problem of finding out how many ABCs are in order. I didn't have to worry about the performance, so I simply picked up three and checked if they matched.
I think there is a better way, but ... I converted the two sequences by "what number is the largest number", compared the two sequences, and multiplied each digit by the corresponding factorial value.
I can't explain it in letters very well. I think it's easier to understand if you look at the code.
The least common multiple problem. I don't know why it's wrong!
As a basic policy --Least common multiple calculation --Output the value obtained by dividing the given m + least common multiple / 2 by the least common multiple
I did it at. However, if the sequence is 2/4/6, the answer will be 0. Because there is no such thing as "the power of 2". 2 * (p + 0.5) is not a multiple of 2, but 4 * (p + 0.5) is a multiple of 2. As you can see, all the numbers in the sequence need to be the power of two.
However, the answer is incorrect. I was struggling with this problem and ended up ... https://github.com/ko-flavor/atcoder-java/blob/master/atcoder/src/abc/abc150/MainD.java
I didn't know how much I thought about it today, so I'd like to see it again at a later date!
(Addition) I found a bug in the program and fixed it to AC.
Recommended Posts