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

No.1673 Lamps on a line

yukicoder.me まずは二つのコードを AC N,Q = map(int,input().split()) switch = [0]*(N) ans = 0 for i in range(Q): L,R = map(int,input().split()) for j in range(L-1,R): if switch[j] == 0: switch[j] = 1 ans += 1 else: switch[j] = 0 ans -= 1 pr…

Permission denied (publickey) について

鍵に独自の名前を付けて保存した場合に限り下記が必要 今回はGithub用に作成した際に起きたのでそのような名前です Host github github.com HostName github.com IdentityFile ~/.ssh/id_rsa_github #付けた名前にする User git こんな単純で初歩的なことで…

Python3ではTLEなのにPyPy3だと通った話

atcoder.jp 『アルゴリズムと数学』の4.1-2の演習問題でそれは起きました 「034 - Nearest Points」 注意 文中のPythonは処理系のCPythonのことを指しています 言語のPythonを指す際は、Python言語と記載しています 問題の起きたコード N = int(input()) X,Y…

yukicoder No.1644 Eight Digits

yukicoder.me 解答 from itertools import permutations K = int(input()) N = permutations('12345678',8) cnt = 0 for i in N: if int(''.join(list(i))) % K == 0: cnt += 1 print(cnt) permutations('****', N) これは第一引数の文字列をN個並べてできる…

DeprecationWarning: find_element_by_class_name is deprecated.について

内容 タイトルからわかりづらく失礼しました O'reilly社の『退屈なことはPythonにやらせよう』を読んでいて、 なにかとSeleniumのところでつまづく 理由としては本ではバージョンが3なのに対して、 自分が使っているバージョンがSelenium4なため なのでいち…

WSL2でSleniumモジュールを使う

O'reilly社の『退屈なことはPythonにやらせよう』の11章でSeleniumを使うのですが 初っ端つまづいたのでその解決方法 環境 WSL2 Python 3.8.10 Ubuntu-20.04 selenium 4.1.3 from selenium import webdriver browser = webdriver.Firefox() 以下省略 上記をP…

ABC224 B - Mongeness

atcoder.jp 解答 h,w = map(int,input().split()) a = [[0]*w]*h flag = False for i in range(h): a[i] = list(map(int,input().split())) for i in range(h-1): for j in range(w-1): if (a[i][j]+a[i+1][j+1]) > (a[i+1][j]+a[i][j+1]): flag = False bre…

ABC225 B - Star or Not

atcoder.jp 解答 n = int(input()) cnt = [0] * (n+1) for _ in range(n-1): a,b = map(int,input().split()) cnt[a] += 1 cnt[b] += 1 for i in range(1,n+1): if cnt[i] == (n-1): print('Yes') exit() print('No') ひたすら多重配列に入力値を入れて、そ…

ABC228 B - Takahashi's Secret

atcoder.jp 解答 n,x = map(int,input().split()) a = list(map(int,input().split())) set1 = {x} ind = 0 cnt = 1 for i in range(n): if 2 <= cnt: if ind != a[ind-1]: ind = a[ind-1] set1.add(ind) cnt += 1 else: if ind != a[x-1]: ind = a[x-1] set…