[0]) number_of_islands = 0 for i in range(rows): for j in range(cols): if grid[i][j] == "1": dfs(i, j) number_of_islands += 1 return number_of_islands # Runtime Details 267ms Beats 88.38%of users with Python3 # Memory Details 18.92MB Beats 56.31%of users with Python3...
run(hobo, shots=10000) #上位3件 for r in result[:3]: print(f'Energy {r[1]}, Occurrence {r[2]}') #さくっと配列に arr, subs = Auto_array(r[0]).get_ndarray('q{}_{}') print(arr) #さくっと画像に img, subs = Auto_array(r[0]).get_image('q{}_{}') plt.figure(...
split()) # つながっている頂点を記録する二次元配列 # 最初は全ての初期値をFalseにする connect=[[False]*(N+1) for i in range(N+1)] # M回 for i in range(M): # 入力の受け取り U,V=map(int,input().split()) # 頂点Uと頂点Vがつながっている⇔Trueと記録 connect[U][V]...
x, y = dummy_fluid.get("x","y")foriinrange(np):if-dx /2<= x[i] <= box_length + dx /2:if-dx /2<= y[i] <= box_height + dx /2: indices.append(i) to_remove = base.LongArray(len(indices)) to_remove.set_data(numpy.array(indices)) dummy_fluid.remove_particles(to_rem...
glob(img_paths) # 画像データ・正解ラベル格納用配列 data = [] labels = [] # 各画像データ・正解ラベルを格納する for img_path in img_path_list: # 画像読み込み・(3, height, width)に転置・正規化 img = TF.to_tensor(cv2.imread(img_path)) # 画像をdataにセット data....
Qiita Conference 2024 Autumn will be held!: 11/14(Thu) - 11/15(Fri) Qiita Conference is the largest tech conference in Qiita! Keynote Speaker Takahiro Anno, Masaki Fujimoto, Yukihiro Matsumoto(Matz) View event detailsarrow_forward © 2011-2024Qiita Inc....