2021/01/13 Day1
- LiveShareの使い方 & 実行の仕方
- 入出力
- 四則演算
問題
- ABC188A: https://atcoder.jp/contests/abc188/tasks/abc188_a
- ABC187A: https://atcoder.jp/contests/abc187/tasks/abc187_a
- ABC186A: https://atcoder.jp/contests/abc186/tasks/abc186_a
四則演算
# +, -, *, /
# print(4 < 7, 4 > 7, 4 == 7)
# 比較: <, >, <=, >=, ==(等号)文字、整数(int), 小数(float)
print(3) # 数字
print(int("3")) # 文字->数字
input() # -> 文字がもらえる
print(3.14) # 小数
print(int(3.14)) # 3
print(float("3.14")) # 3.14if
下がっている部分が if の有効範囲(スコープ)
if 4 < 2:
# True のとき
print('y')
else:
# False のとき
print('n')ABC186A
# 3 - 5 -> 6 - 5 -> Yes
# 16 - 2 -> 16 - 5 -> No
# 方針: 小さい方に3を足して大きい方と比較
# ^^^^^
x, y = map(int, input().split(' ')) # 気にしない
if x < y:
# smallにxの中身を入れる
small = x
big = y
else:
# x >= y
small = y
big = x
if (big-small) < 3: # True or False
print('Yes')
else:
print('No')切り捨て, 切り上げ
import math
print(3 / 2)
# int() で切り捨て
print(int(3 / 2))
# 切り捨て
print(math.floor(3.3))
# 切り上げ
print(math.ceil(3.3))
# 整数商
print(n // w)