TLE???
查看原帖
TLE???
1236984
AC_kkk0926楼主2024/1/28 11:30

求改

TLE了5个,AC了5个

#include <bits/stdc++.h>
using namespace std;
int ac(int x){
	if(x==1){
		return 1;
	}
	else if(x==2){
		return 2;
	}
    else{
		return ac(x-1)+ac(x-2);
	}
}
int main(){
    int a;
    cin>>a;
    cout<<ac(a);
	return 0;
}
2024/1/28 11:30
加载中...