__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 __Real_Madrid__ @ 2024-08-18 21:24:25
@xht_G .........
by xht_G @ 2024-08-18 21:24:44
@__Real_Madrid__ 可以储存[-2^127,2^127-1]以内的所有整数,并能做简单的运算,但输入输出需要快读快写
by xht_G @ 2024-08-18 21:26:04
@__Real_Madrid__ 下面是P1001中的使用示例:
#include<bits/stdc++.h>
#define PII pair<int,int>
#define DB double
#define LL long long
//#define int long long
//#define int __int128
//const int mod=1e9+7;
//const int mod=998244353;
const LL inf=0x3f3f3f3f,INF=1e16;
namespace FastIO{
inline int read(int mod){
int x=0,f=1;char ch=getchar();
if(mod==0){while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}}
else{while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x*10%mod+ch-48)%mod;ch=getchar();}}
return x*f;}
inline char cread(){char x;while(x==0||x==' '||x=='\n'||x=='\r')x=getchar();return x;}
inline void write(int x){if(x<0)putchar('-'),x=-x;if(x==0)return;write(x/10),putchar(x%10+'0');}
}
using namespace FastIO;
using namespace std;
signed main(){
__int128 a=read(0),b=read(0);
printf("%lld\n",(LL)(a+b));
return 0;
}
by __Real_Madrid__ @ 2024-08-18 21:26:09
@xht_G OKOK听懂了,感谢大佬,我应该关注了吧
by LCY2015 @ 2024-08-30 13:01:06
@xht_G @guojiahong 要高精?
by LCY2015 @ 2024-08-30 13:03:10
@xuruizhe150711 @guojiahong @xht_G int128是什么???