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 3 years have passed since last update.

ABC127 A,B,C 解説(python)

Posted at

A問題

a,b = map(int,input().split())
if 13 <= a:
    print(b)
elif 6 <= a <= 12:
    print(b//2)
else:
    print(0)

if文にて年齢ゾーンを判別、金額を出力する。

B問題

r,d,x = map(int,input().split())
for i in range(10):
    print(r*x-d)
    x = r*x-d

漸化式(前の計算結果を次の計算結果に当てはめる)問題

C問題

n,m = map(int,input().split())
l = [0]*m
r = [0]*m
for i in range(m):
    l[i],r[i] = map(int,input().split())
if min(r)-max(l) < 0:
    print(0)
else:
    print(min(r)-max(l)+1)

全てにおいて重なっている区間と言うことで
もっとも大きいlと最も小さいrの間のキーが該当する。

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?