AtCoder Beginner Contest 164 - Battle

Takahashi and Aoki will have a battle using their monsters.
The health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.
The two monsters will take turns attacking, in the order Takahashi's, Aoki's, Takahashi's, Aoki's, ...
Here, an attack decreases the opponent's health by the value equal to the attacker's strength.
The monsters keep attacking until the health of one monster becomes 0 or below. The person with the monster whose health becomes 0 or below loses, and the other person wins.
If Takahashi will win, print Yes; if he will lose, print No.

-----Constraints-----
 - 1 \leq A,B,C,D \leq 100
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
A B C D

-----Output-----
If Takahashi will win, print Yes; if he will lose, print No.

-----Sample Input-----
10 9 10 10

-----Sample Output-----
No

First, Takahashi's monster attacks Aoki's monster, whose health is now 10-9=1.
Next, Aoki's monster attacks Takahashi's monster, whose health is now 10-10=0.
Takahashi's monster is the first to have 0 or less health, so Takahashi loses.

Difficulty: EASY

Starter code:

Solutions:
(a, b, c, d) = map(int, input().split())
if -(-a // d) + 1 > -(-c // b):
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
x = -(-c // b)
y = -(-a // d)
if x <= y:
	print('Yes')
else:
	print('No')


class Monster:

	def __init__(self, hp, attack):
		self.hp = hp
		self.attack = attack
		self.death = False

class Game:

	def __init__(self, monsters: list):
		self.monsters = monsters

	def calc_damage(self, offence, defence):
		self.monsters[defence].hp -= self.monsters[offence].attack
		if self.monsters[defence].hp <= 0:
			self.monsters[defence].death = True
		return self.monsters[defence].death

	def battle(self):
		while True:
			self.calc_damage(0, 1)
			if self.monsters[1].death:
				print('Yes')
				break
			self.calc_damage(1, 0)
			if self.monsters[0].death:
				print('No')
				break
(a, b, c, d) = list(map(int, input().split()))
t_monster = Monster(a, b)
a_monster = Monster(c, d)
game = Game([t_monster, a_monster])
game.battle()


(A, B, C, D) = map(int, input().split())
import math
if math.ceil(A / D) >= math.ceil(C / B):
	print('Yes')
else:
	print('No')


import math
(a, b, c, d) = map(int, input().split())
print('Yes' if math.ceil(a / d) > math.ceil(c / b) - 1 else 'No')


(A, B, C, D) = map(int, input().split())
while True:
	C -= B
	if C <= 0:
		print('Yes')
		return
	A -= D
	if A <= 0:
		print('No')
		return


(A, B, C, D) = map(int, input().split())
print('Yes' if (A + D - 1) // D >= (C + B - 1) // B else 'No')


(a, b, c, d) = map(int, input().split())
print('YNeos'[0 - -a // d < 0 - -c // b::2])


(A, B, C, D) = map(int, input().split())
while A > 0 and C > 0:
	A = A - D
	C = C - B
if C <= 0:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
T = -(-c // b)
A = -(-a // d)
print(['Yes', 'No'][A < T])


(a, b, c, d) = map(int, input().split())
while a > 0 and c > 0:
	c -= b
	a -= d
print('Yes' if c <= 0 else 'No')


class Monster:

	def __init__(self, hp, at):
		self.hp = hp
		self.at = at

	def fight(self, at) -> int:
		self.hp -= at
		return self.hp

	def is_loser(self) -> bool:
		return self.hp <= 0
(A, B, C, D) = map(int, input().split())
takahashi_monster = Monster(A, B)
aoki_monster = Monster(C, D)
while True:
	aoki_monster.fight(B)
	if aoki_monster.is_loser():
		result = 'Yes'
		break
	takahashi_monster.fight(D)
	if takahashi_monster.is_loser():
		result = 'No'
		break
print(result)


(a, b, c, d) = map(int, input().split())
tak = -(-a // d)
aoki = -(-c // b)
if tak < aoki:
	print('No')
else:
	print('Yes')


(A, B, C, D) = list(map(int, input().split()))

def answer(A: int, B: int, C: int, D: int) -> str:
	while True:
		C -= B
		if C <= 0:
			return 'Yes'
			break
		A -= D
		if A <= 0:
			return 'No'
			break
print(answer(A, B, C, D))


(a, b, c, d) = map(int, input().split())
flg = 0
for i in range(10 ** 100):
	if flg == 0:
		c -= b
		flg = 1
	else:
		a -= d
		flg = 0
	if a <= 0 or c <= 0:
		print('Yes' if c <= 0 else 'No')
		break


(a, b, c, d) = map(int, input().split())
s = -(-a // d)
t = -(-c // b)
if s >= t:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
t = (a - 1) // d + 1
ao = (c - 1) // b + 1
if t - ao >= 0:
	print('Yes')
else:
	print('No')


(A, B, C, D) = map(int, input().split())
X = -(-A // D)
Y = -(-C // B)
if X >= Y:
	print('Yes')
else:
	print('No')


import sys

def __starting_point():
	(A, B, C, D) = list(map(int, input().split()))
	while True:
		C -= B
		if C <= 0:
			print('Yes')
			return
		A -= D
		if A <= 0:
			print('No')
			return
__starting_point()


(A, B, C, D) = list(map(int, input().split()))
while A > 0 and C > 0:
	C -= B
	if C <= 0:
		print('Yes')
		break
	else:
		A -= D
		if A <= 0:
			print('No')
			break
		else:
			continue


(a, b, c, d) = list(map(int, input().split()))
ad = -(-a // d)
cb = -(-c // b)
print('Yes' if ad >= cb else 'No')


(A, B, C, D) = map(int, input().split())
a = -(-C // B)
b = -(-A // D)
if a <= b:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
e = -(-c // b)
f = -(-a // d)
if e <= f:
	print('Yes')
else:
	print('No')


import math
(a, b, c, d) = map(int, input().split())
(x, y) = (math.ceil(a / d), math.ceil(c / b))
print('Yes' if x >= y else 'No')


(A, B, C, D) = list(map(int, input().split()))
turn = 0
while A > 0 and C > 0:
	if turn == 0:
		C -= B
		turn = 1
	else:
		A -= D
		turn = 0
if A <= 0:
	print('No')
else:
	print('Yes')


import math
(A, B, C, D) = list(map(int, input().split()))
while True:
	C -= B
	if C <= 0:
		print('Yes')
		break
	A -= D
	if A <= 0:
		print('No')
		break


a = list(map(int, input().split()))
if -(-a[0] // a[3]) >= -(-a[2] // a[1]):
	print('Yes')
else:
	print('No')


(a, b, c, d) = list(map(int, input().split()))
while True:
	c -= b
	if c <= 0:
		print('Yes')
		break
	a -= d
	if a <= 0:
		print('No')
		break


(a, b, c, d) = map(int, input().split())
ac = c / b
cc = -(-a // d)
if ac <= cc:
	print('Yes')
else:
	print('No')


(A, B, C, D) = map(int, input().split())
m = A // D
n = C // B
if A % D != 0:
	m += 1
if C % B != 0:
	n += 1
if m >= n:
	print('Yes')
else:
	print('No')


(tH, tA, aH, aA) = map(int, input().split())
print('Yes') if (aH - 1) // tA + 1 <= (tH - 1) // aA + 1 else print('No')


(a, b, c, d) = map(int, input().split())
takahashi_hp = a
aoki_hp = c
while True:
	aoki_hp = aoki_hp - b
	if aoki_hp <= 0:
		print('Yes')
		break
	takahashi_hp = takahashi_hp - d
	if takahashi_hp <= 0:
		print('No')
		break


(A, B, C, D) = list(map(int, input().split()))
result = 'Yes'
while A > 0 or C > 0:
	C -= B
	A -= D
	if C <= 0:
		break
	elif A <= 0:
		result = 'No'
		break
print(result)


import math
(a, b, c, d) = map(int, input().split())
x = math.ceil(a / d)
z = math.ceil(c / b)

def result():
	if x >= z:
		return 'Yes'
	else:
		return 'No'
print(result())


(a, b, c, d) = map(int, input().split())
while 1:
	c -= b
	if c <= 0:
		print('Yes')
		break
	a -= d
	if a <= 0:
		print('No')
		break


(a, b, c, d) = map(int, input().split())
ta = a
ao = c
while ta > 0 and ao > 0:
	ao = ao - b
	ta = ta - d
	if ao <= 0:
		print('Yes')
	elif ta <= 0:
		print('No')
		return


import math
(a, b, c, d) = map(int, input().split())
N = math.ceil(c / b)
print(['No', 'Yes'][a - (N - 1) * d > 0])


(a, b, c, d) = [int(j) for j in input().split()]
p = -(-c // b)
q = -(-a // d)
if p <= q:
	print('Yes')
else:
	print('No')


(A, B, C, D) = list(map(int, input().split()))
T = -(-C // B)
AO = -(-A // D)
print('Yes' if T <= AO else 'No')


import sys
(a, b, c, d) = map(int, input().split())
for _ in range(100):
	a_t = c - b
	if a_t <= 0:
		print('Yes')
		return
	c = a_t
	t_t = a - d
	if t_t <= 0:
		print('No')
		return
	a = t_t


(a, b, c, d) = map(int, input().split())
(p, q) = (c // b + (c % b > 0), a // d + (a % d > 0))
print('Yes') if p <= q else print('No')


(A, B, C, D) = map(int, input().split())
taka = 0
aoki = 0
while A > 0:
	A -= D
	taka += 1
while C > 0:
	C -= B
	aoki += 1
if taka >= aoki:
	print('Yes')
else:
	print('No')


def battle():
	(A, B, C, D) = map(int, input().split())
	attackT = A // D
	attackA = C // B
	if A % D != 0:
		attackT += 1
	if C % B != 0:
		attackA += 1
	res = 'Yes'
	if attackT < attackA:
		res = 'No'
	print(res)
battle()


(a, b, c, d) = map(int, input().split())
ta = 0 - -c // b
ao = 0 - -a // d
if ta <= ao:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
print('Yes' if int(c / b + 0.9999) <= int(a / d + 0.9999) else 'No')


(a, b, c, d) = map(int, input().split())
taka = -(-c // b)
ao = -(-a // d)
if taka <= ao:
	print('Yes')
	exit()
print('No')


(A, B, C, D) = map(int, input().split())
x = -(-A // D)
y = -(-C // B)
if x >= y:
	print('Yes')
else:
	print('No')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, bisect
import sys
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
nf = lambda : float(ns())
na = lambda : list(map(int, stdin.readline().split()))
nb = lambda : list(map(float, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
(A, B, C, D) = na()
t = (C + B - 1) // B
a = (A + D - 1) // D
print('Yes') if t <= a else print('No')


from math import ceil
(a, b, c, d) = map(int, input().split())
A = ceil(c / b)
B = ceil(a / d)
print('Yes' if A <= B else 'No')


monsters = input()
list = monsters.split(' ')
a = int(list[0])
b = int(list[1])
c = int(list[2])
d = int(list[3])
while True:
	c = c - b
	if c <= 0:
		print('Yes')
		break
	a = a - d
	if a <= 0:
		print('No')
		break


(a, b, c, d) = map(int, input().split())
print('YNeos'[(c - 1) // b > (a - 1) // d::2])


def main() -> None:
	(a, b, c, d) = list(map(int, input().split()))
	if a % d == 0:
		turn_t = a // d
	else:
		turn_t = a // d + 1
	if c % b == 0:
		turn_a = c // b
	else:
		turn_a = c // b + 1
	print('Yes' if turn_a <= turn_t else 'No')
	return

def __starting_point():
	main()
__starting_point()


N = list(map(int, input().split()))
flag = 0
while N[0] > 0 and N[2] > 0:
	N[2] = N[2] - N[1]
	if N[2] <= 0:
		flag = 1
		break
	else:
		N[0] = N[0] - N[3]
		if N[0] <= 0:
			break
if flag == 1:
	print('Yes')
else:
	print('No')


(a, b, c, d) = [int(x) for x in input().split()]
if (c - 1) // b > (a - 1) // d:
	print('No')
else:
	print('Yes')


import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp
INF = inf
MOD = 1000000007
(a, b, c, d) = [int(i) for i in input().split()]
tmp = 0
res = 'No'
while True:
	c -= b
	if c <= 0:
		res = 'Yes'
		break
	a -= d
	if a <= 0:
		break
print(res)


(a, b, c, d) = map(int, input().split())
T = c // b + (c % b != 0)
A = a // d + (a % d != 0)
print('Yes' if T <= A else 'No')


(a, b, c, d) = [int(i) for i in input().split()]
c = -(-c // b)
a = -(-a // d)
print('Yes' if c <= a else 'No')


(tkhp, tkat, aohp, aoat) = list(map(int, input().split()))
while True:
	aohp -= tkat
	if aohp <= 0:
		print('Yes')
		break
	tkhp -= aoat
	if tkhp <= 0:
		print('No')
		break


(th, ta, ah, aa) = map(int, input().split())
if -(-ah // ta) <= -(-th // aa):
	print('Yes')
else:
	print('No')


import math
(a, b, c, d) = map(float, input().split())
if c <= b * math.ceil(a / d):
	print('Yes')
else:
	print('No')


(A, B, C, D) = map(int, input().split())
Ta = -(-C // B)
Ao = -(-A // D)
print('Yes' if Ta <= Ao else 'No')


(A, B, C, D) = map(int, input().split())

class Monster:

	def __init__(self, life, power):
		self.life = life
		self.power = power
takahasi = Monster(A, B)
aoki = Monster(C, D)
while takahasi.life > 0 and aoki.life > 0:
	AHP = aoki.life - takahasi.power
	aoki.life = AHP
	THP = takahasi.life - aoki.power
	takahasi.life = THP
	if AHP <= 0:
		print('Yes')
		break
	if THP <= 0:
		print('No')
		break


(A, B, C, D) = map(int, input().split())
d = C // B
e = C % B
if e == 0:
	d = d - 1
if d * D >= A:
	print('No')
else:
	print('Yes')


(A, B, C, D) = map(int, input().split())

class Monster:

	def __init__(self, life, power):
		self.life = life
		self.power = power

def answer(A: int, B: int, C: int, D: int) -> str:
	takahasi = Monster(A, B)
	aoki = Monster(C, D)
	while takahasi.life > 0 and aoki.life > 0:
		A_HP = aoki.life - takahasi.power
		aoki.life = A_HP
		T_HP = takahasi.life - aoki.power
		takahasi.life = T_HP
		if A_HP <= 0:
			return 'Yes'
			break
		if T_HP <= 0:
			return 'No'
			break
print(answer(A, B, C, D))


(a, b, c, d) = list(map(int, input().split()))
for i in range(220):
	if i % 2 == 0:
		c -= b
	else:
		a -= d
	if c <= 0:
		print('Yes')
		return
	elif a <= 0:
		print('No')
		return


class Monster:

	def __init__(self, hp, power):
		self.hp = hp
		self.power = power

	def fight(self, power) -> int:
		self.hp -= power
		return self.hp

	def is_loser(self) -> bool:
		return self.hp <= 0
(a, b, c, d) = list(map(int, input().split()))
takahashi_monster = Monster(a, b)
aoki_monster = Monster(c, d)
result = 'ret'
while True:
	aoki_monster.fight(b)
	if aoki_monster.is_loser():
		result = 'Yes'
		break
	takahashi_monster.fight(d)
	if takahashi_monster.is_loser():
		result = 'No'
		break
print(result)


(a, b, c, d) = list(map(int, input().split()))

def answer(a: int, b: int, c: int, d: int) -> str:
	if (c + b - 1) // b <= (a + d - 1) // d:
		return 'Yes'
	else:
		return 'No'
print(answer(a, b, c, d))


(a, b, c, d) = map(int, input().split())
if c % b == 0:
	t = c / b
else:
	t = c // b + 1
if a % d == 0:
	o = a / d
else:
	o = a // d + 1
if t > o:
	print('No')
elif t <= o:
	print('Yes')


def i_input():
	return int(input())

def i_map():
	return map(int, input().split())

def i_list():
	return list(map(int, input().split()))

def i_row(N):
	return [int(input()) for _ in range(N)]

def i_row_list(N):
	return [list(map(int, input().split())) for _ in range(N)]
(tHP, tATK, aHP, aATK) = i_map()
while True:
	aHP = max(aHP - tATK, 0)
	if aHP == 0:
		ans = 'Yes'
		break
	tHP = max(tHP - aATK, 0)
	if tHP == 0:
		ans = 'No'
		break
print(ans)


(A, B, C, D) = map(int, input().split())
while A > 0:
	C -= B
	if C <= 0:
		print('Yes')
		exit()
	A -= D
print('No')


(a1, a2, b1, b2) = map(int, input().split())
if -(-b1 // a2) <= -(-a1 // b2):
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
print(['No', 'Yes'][a // d + (a % d > 0) >= c // b + (c % b > 0)])


(A, B, C, D) = map(int, input().split())
while C > 0 or A > 0:
	C -= B
	if C <= 0:
		print('Yes')
		break
	A -= D
	if A <= 0:
		print('No')
		break


(A, B, C, D) = map(int, input().split())
print('YNeos'[(A + D - 1) // D < (C + B - 1) // B::2])


(a, b, c, d) = map(int, input().split())
N = -(-c // b)
M = -(-a // d)
if N <= M:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
takahashi_turn = 0
aoki_turn = 0
while c - b > 0:
	takahashi_turn += 1
	c -= b
while a - d > 0:
	aoki_turn += 1
	a -= d
if takahashi_turn <= aoki_turn:
	print('Yes')
else:
	print('No')


(A, B, C, D) = [int(x) for x in input().split()]
t = (C + B - 1) // B
a = (A + D - 1) // D
print('Yes' if t <= a else 'No')


(hp1, atk1, hp2, atk2) = map(int, input().split())
print('Yes' if hp2 / atk1 <= -(-hp1 // atk2) else 'No')


(t_hp, t_atk, a_hp, a_atk) = list(map(int, input().split()))
t_count = 0
a_count = 0
while a_hp > 0:
	a_hp -= t_atk
	t_count += 1
while t_hp > 0:
	t_hp -= a_atk
	a_count += 1
if t_count <= a_count:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
cna = (a + d - 1) // d
cnc = (c + b - 1) // b
print(['Yes', 'No'][cna < cnc])


(a, b, c, d) = map(int, input().split())
j = -(-c // b)
k = -(-a // d)
if j <= k:
	print('Yes')
else:
	print('No')


(A, B, C, D) = map(int, input().split())
-(-4 // 3)
if -(-C // B) > -(-A // D):
	print('No')
else:
	print('Yes')