https://www.foresight.jp/fe/column/shift-operation/左シフトは掛け算a=1a|=a #1倍print(bin(a),a)a=a<<1 #1ビットシフトで2倍print(bin(a),a)a=1a|=a<<1 #1ビットシフトしてOR演算で3倍print(bin(a),a)a=1a=a<<2 #2ビットシフトで4倍 . . . 本文を読む
bin(2) → 0b10https://www.foresight.jp/fe/column/shift-operation/X&1 →一番右のビットが1ならtrue 0ならfalseを返す例)2&1→0 1&1→1 5&1→5009 - Brute Force 2https://atcoder.jp/contests/math-and-algo . . . 本文を読む
abc085 B - Kagami Mochihttps://atcoder.jp/contests/abc085/tasks/abc085_bset型は一意な値のみが要素として残る性質があるので↓これでいけるn=int(input())
d=set()
for i in range(n):
d.add(int(input()))
#d=set(input() for i . . . 本文を読む
典型アルゴリズム問題集 A - 二分探索の練習問題 https://atcoder.jp/contests/typical-algorithm/tasks/typical_algorithm_aimport bisect
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
print . . . 本文を読む
https://atcoder.jp/contests/arc044/submissions/41666736
この処理だと間違いになる
n=int(input())
s=str(n)[-1]
ss=str(s)
sum=0
for sss in ss:
sum+=int(sss)
if int(s)%2!=0 and s!=5 and sum%3!=0:
p . . . 本文を読む