メモ帳

楽しいアウトプットの場所

2021-01-01から1ヶ月間の記事一覧

【Python】numpyを競技プログラミングでつかう!!

ABC188 B問題 atcoder.jp import numpy as np n = input() a = np.array(input().split(), dtype=int) b = np.array(input().split(), dtype=int) print('Yes' if np.dot(a, b)==0 else 'No')

Python こんなことができるのか!!メモ

配列の値を変数入力移す A = [1, 2, 3, 4] a, b, c, d = A print(a, b, c, d) 1 2 3 4

Python コード短縮!!(他人のコードを観察したメモ)ABC187より

'12345'などの数字からなる文字列があったときに、各桁の数を整数型(int型)の配列へと変換 s = input() A = [] for e in s: A.append(int(e)) 上の書き方よりも s = input() A = [int(i) for i in s] ABC187 A問題の解答 A - Large Digits a, b = input().sp…

c++ set 使い方

宣言と要素入れ込み set<int> st; st.insert(10); st.insert(20); for(auto x : st) cout << x <<" "; cout << endl; 出力 10 20 要素の削除 st.erase(10); for(auto x : st) cout << x <<" "; cout << endl; 20 要素の探索 setの中に存在するか否か set<int> st{10, 2</int></int>…