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?

AtCoder Beginner Contest 073B - Theaterメモ

Posted at

問題

AtCoder Beginner Contest 073

考察

入力をfor文を用いて行う。その後、for文を使って最終的に表示する数字をつくる。この際どのくらいの席数一組の団体が座ったかはl席からr席まで座ったとすると、$l-r+1$で出せる

ACコード

n=int(input())
l=[]
r=[]
for i in range(n):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)
ans = 0
for i in range(n):
    ans += r[i] - l[i] + 1
print(ans)
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?