TA的每日心情 | 无聊 2020-7-27 10:26 |
---|
签到天数: 1 天 [LV.1]初学乍练
普通会员

- 积分
- 18
|
发表于 2020-7-27 10:28:23
|
显示全部楼层
def routes(m, n):$ k4 R- b' k0 S1 e; |7 q2 i3 U0 W
if m==1|n==1 :
& ?: C* _, D/ I4 q3 X3 @% O return m+n; |2 S& A% Q) {/ ^+ {
else:$ G0 H/ i6 k* n" d
return routes(m-1,n)+routes(m,n-1)
U8 Z8 S% o$ {& F1 R: P% o6 Qwhile True:0 C- j- |; `; h: a ? z
try:
6 n- x* A6 z# d. {' Q. ` nums = list(map(int, input().split()))
, t- n5 t, P$ m: \0 Y m, n = nums[0], nums[1]3 s5 c) Y" r+ F- x( l; i( G
print(routes(m, n)) O8 {9 B1 x8 d( c, h
except:
( z$ Y7 I8 H' a& b8 E break |
|