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 253B - Distance Between Tokens」メモ

Posted at

問題

AtCoder Beginner Contest 253

考察

oの位置を記録する配列をつくる。

ans.append(i,j)

で一つの部分に二個のデータをまとめた配列がつくれる。

ACコード

def Tokens(a,h,w):
    ans = []
    for i in range(h):
        for j in range(w):
            if a[i][j] == "o":
                ans.append((i,j))
    return ans

h,w=map(int,input().split())

s= [input() for _ in range(h)]

ans = Tokens(s,h,w)

a,c = ans[0]
b,d = ans[1]

print(abs(a-b)+abs(c-d))
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?