Solve AtCoder Beginner Contest 153 in java

AtCoder Beginner Contest 153 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 TLE from F.

I will explain briefly below.

Problem A

The problem that HP attacks H monsters with attack power A and asks how many times they can be defeated. It should be okay if you pay attention to the processing when the H / A is just divisible.

Problem B

The problem of adding up the numbers (attack power of the special move) and asking whether it will reach the opponent's HP. You should be able to do a simple addition.

Problem C

There are N monsters, and you can use special moves K times. You can kill monsters instantly with this special move, so if you are asked who to use this special move, you can add up the physical strength of the remaining enemies.

Of course, I want to use K-body Special Moves in descending order of physical strength, so let's do our best to express it with code.

Problem D

If you attack once, the monster becomes H / 2 health and splits, and if you have 1 health, you can defeat it. This was relatively simple with ** number of enemies ** and ** enemy health **.

With one operation Add the number of attacks by ** the number of enemies ** Halve the ** enemy's health ** Double the number of ** enemies **

It is OK if you repeat this operation until your physical strength becomes 0.

Problem E

I don't know, thinking that it seems to be a standard problem of algorithms.

Problem F

It was a two-line TLE ... My way of thinking ① Sort the coordinates in ascending order ② Convert how many attacks can defeat the enemy's physical strength As a pretreatment,

① Get one coordinate in ascending order ② Get how many more times the enemy at that point can be defeated ③ From there, get points for the range of the bomb ④ Attack the enemies in that range as much as you got in ②.

I think that it will be AC if it can be implemented properly, but I feel that the basic idea is not wrong.

The rating is 956 → 944.

I was able to get to the D problem in 17 minutes, and I felt growth. It seems that the rate will not increase from here unless it can be solved after the E problem. ..

We will review both the E and F questions this time! !! : cry:

Recommended Posts

Solve AtCoder Beginner Contest 151 in java
Solve AtCoder Beginner Contest 150 in java
Solve AtCoder Beginner Contest 153 in java
Solve AtCoder Beginner Contest 175 in java
Solve AtCoder Beginner Contest 160 in java
Solve AtCoder Beginner Contest 152 in java
Solve AtCoder Beginner Contest 156 in java
AtCoder Beginner Contest 168
AtCoder Beginner Contest 167 C Problem (Java)
AtCoder Beginner Contest 182 Participation Article
AtCoder Beginner Contest 132 D Problem
java beginner 4
java beginner 3
java beginner
AtCoder dwango Programming Contest B in Ruby, Perl and Java
AtCoder ARC 081 C hash to solve in Ruby, Perl and Java
Try to solve Project Euler in Java
Partization in Java
Changes in Java 11
Sorting AtCoder ABC 111 C hashes to solve in Ruby, Perl and Java
Rock-paper-scissors in Java
Java Beginner Exercises
Pi in Java
FizzBuzz in Java
Java Exercise "Beginner"
AtCoder Beginner Contest 169 A, B, C with ruby
Basics of threads and Callable in Java [Beginner]
[AtCoder Problem-ABC001] C-Do wind observation in Java [Code]
How to solve an Expression Problem in Java
[Beginner] Install java development tool in cloud9 development environment.
A story about a super beginner participating in the AtCoder contest for the first time (AtCoder Beginner Contest 140)
Interpreter implementation in Java
Make Blackjack in Java
Rock-paper-scissors app in Java
Constraint programming in Java
Put java8 in centos7
NVL-ish guy in Java
"Hello World" in Java
Callable Interface in Java
It's late! Try implementing Android Notification in Java (Beginner)
Comments in Java source
Azure functions in java
Format XML in Java
AtCoder Beginner Contest 170 A, B, C up to ruby
Simple htmlspecialchars in Java
Boyer-Moore implementation in Java
Hello World in Java
Use OpenCV in Java
webApi memorandum in java
Type determination in Java
Ping commands in Java
Various threads in java
Heapsort implementation (in java)
Zabbix API in Java
ASCII art in Java
Compare Lists in Java
Express failure in Java
Try to solve a restricted FizzBuzz problem in Java
Create JSON in Java
Date manipulation in Java 8