__Real_Madrid__ @ 2024-08-18 21:13:18
有没有大佬浅浅看一眼为什么后四个测试点WA?,60分
#include<bits/stdc++.h>
using namespace std;
long long a[5010];
long long f(int n){
if (n==1)return 1;
if(n==2)return 2;
if (a[n])return a[n];
return a[n]=f(n-1)+f(n-2);
}
int main(){
long long n;
cin>>n;
cout<<f(n);
return 0;
}
感谢!!
by xht_G @ 2024-08-18 21:17:53
后四个点n<=5000,longlong会炸,要用高精。求关
by guojiahong @ 2024-08-18 21:18:06
这题可能要写高精
by guanzisheng2 @ 2024-08-18 21:18:56
int128试试?
by __Real_Madrid__ @ 2024-08-18 21:19:44
@xht_G @guojiahong 要高精啊?!
by xht_G @ 2024-08-18 21:20:09
@__Real_Madrid__ 1
by guojiahong @ 2024-08-18 21:20:10
int128输入输出不好弄 总之本蒟蒻不会
by xht_G @ 2024-08-18 21:20:35
@xuruizhe150711 int128也会炸
by guojiahong @ 2024-08-18 21:20:41
而且这题int128应该也不够
by __Real_Madrid__ @ 2024-08-18 21:22:08
@xht_G int128是啥???本人太菜
by xht_G @ 2024-08-18 21:23:01
@__Real_Madrid__
就是 __int128