pythonのショートコーディング(if文)
Atcoderのメモ
設問
atcoder.jp
・基本的なif文での解法
a,b= map(int,input().split(" ")) a += b if(a >= 15 and b >= 8): print(1) elif(a >= 10 and b >= 3): print(2) elif(a >= 3): print(3) else: print(4)
・ショートハンド
参考元:
Submission #20751142 - AtCoder Beginner Contest 194
a,b=map(int,input().split()) print(4-(a+b>2)-(2<b>9-a)-(7<b>14-a))