# Solve AtCoder Beginner Contest 152 in java

AtCoder Beginner Contest 152 Thank you for your hard work! Official page

The code I wrote this time is here The result was AC from A to D and WA from E.

I will explain briefly below.

## Problem A

The problem of comparing the arguments N and M. If they are the same, output `Yes`, if they are different, output` No`.

## Problem B

The problem of outputting which of the character string in which a is repeated b times and the character string in which b is repeated a times is faster in ** dictionary order **. Since it is in dictionary order, the smaller of a and b comes first.

If you can output a character string that repeats the smaller a and b for the larger a and b, it is AC.

## Problem C

The explanation is a little difficult, but in the end it is OK if you answer how many times the minimum value was updated in the sequence. 4, 5, 2, 3, 1 In the above case, the number 3 in bold is the correct answer.

## Problem D

Among the numbers below N,

--First number of A = Last number of B --First number of B = Last number of A

It is a question to answer how many combinations of numbers satisfy both of. I thought it wouldn't be in time if I had a double loop in the number of N, so

--Loop first to create a map of the first and last numbers --In the second loop, get the numbers that match the conditions and add them together.

It was made. Personally, I was happy to realize that I had to change my policy because I couldn't make it in time for the calculation.

## Problem E

AiBi = AjBj holds for any i, j. In other words, the problem of finding the least common multiple and dividing by Ai to find Bi.

I understand the part that decides the policy, and if I use the inverse element that I studied recently, it will break with Ai! It was good up to that point, It doesn't work well for large numbers. I was able to identify the cause.

When calculating the least common multiple, it was a large number, and once divided by 1000000007, the least common multiple could not be calculated correctly. As a result of various thoughts, it could not be resolved. ..

I thought about holding the least common multiple in the explanation in the form of prime factorization, but I couldn't make it into a code due to lack of ability. (I haven't got an image of what to do yet, so I'll think about it again at the end of work on weekdays.)

## Problem F

I feel that problem E can be done soon, so I haven't touched it. ..

The rating is 897 → 956. The best update!

I was able to reach the D problem in 25 minutes, and I felt growth. I came up with the idea of using the inverse element of the E problem, but I'm very disappointed that I haven't taken a step further. ..

Next time I want to put learning into shape ...: sunny: