题解 | #Redraiment的走法#
Redraiment的走法
https://www.nowcoder.com/practice/24e6243b9f0446b081b1d6d32f2aa3aa
#include <stdio.h>
int _MaxStep = 0;
void step(int v, int index,int stepCount, int* arr, int max)
{
if(index >= max)
{
if(_MaxStep < stepCount)
_MaxStep = stepCount;
return;
}
else if(index < max){
if(arr[index] > v){
step(v,index+1,stepCount,arr,max);
step(arr[index],index+1,stepCount+1,arr,max);
}else {
step(v,index+1,stepCount,arr,max);
}
}
}
int main() {
int n = 0;
int arr[200] = {0};
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
scanf("%d",&arr[i]);
}
for(int i = 0; i < n; i++)
{
step(arr[i], i+1,1, arr, n);
}
printf("%d",_MaxStep);
return 0;
}

顺丰集团工作强度 374人发布