0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

灰色14級がABC326をpythonでやってみた。(A,B問題)

Posted at

0 はじめに

久しぶりです。あおぷと.zipです。
Ratedで参加できていなかったので間があきました。
ちなみにABC322で灰色14級に昇格しました。
記事のアドバイスあったらコメントに書いてください(お願いします。)
ABC326の問題ページはこちら

1 A - 2UP3DOWN

解説

X - Y が-2より大きく3より小さければYesを出力すればよいです。

コード

a.py
x,y = map(int, input().split())
if -2 <= x - y <= 3:
  print("Yes")
else:
  print("No")

2 B - 326-like Numbers

解説

nを文字列として受け取り,
1文字目 * 2文字目が3文字目と一致するまでnを1ずつ増やしていきます。

コード

b.py
n = input()
s = [] 
for i in range(3):
  s.append(int(n[i]))
line = int(n)
while not s[0] * s[1] == s[2]:
  line = str(n+1)
  s.clear()
  for i in range(3):
    s.append(int(n[i]))
  line = int(n)
  print(n)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?