【今日の競プロ(1)】ABC148
対象
B - Strings with the Same Length
使用言語
Python3 (3.4.3)
A - Round One
考え方
- はじめはA,Bを[1,2,3]のどれかにマッチするかをforで回して、残ったやつを回答とすればいいかと思っていた
- でも、よくよく考えると、選択肢が決まっている、かつ全て数字なので 6 - A - B が回答となることに気づく
解答例
A = int(input()) B = int(input()) print(6-A-B)
B - Strings with the Same Length
B - Strings with the Same Length
考え方
- Nは最大で100なので、計算量的に問題ないので愚直にやる
解答例
N = int(input()) S,T = input().split() ans = "" for i in range(N): ans += S[i]+T[i] print(ans)
C - Snack
考え方
- 単に最小公倍数でよさそう
解答例
import fractions A,B = map(int, input().split()) print(A*B //fractions.gcd(A, B))
fractions使うと若干遅くなるな...