sheryang_UKE @ 2024-02-06 19:31:32
#include<bits/stdc++.h>
using namespace std;
int sum[909526]; int p,tail=1; int main() { cin>>p; sum[1]=1; for(int i=1;i<=p;i++) { for(int i=1;i<=tail;i++) { sum[i]*=2; if(sum[i]>=10&&i==tail) { // cout<<2<<endl; sum[i+1]+=1; sum[i]%=10; tail+=1; } else if(sum[i]>=10) { // cout<<1<<" "; sum[i+1]+=sum[i]/10; sum[i]%=10; } } } cout<<tail<<endl; for(int i=500;i>=1;i--) { cout<<sum[i]; } return 0; }
- 求大佬帮看
by QWQAWAQWQAWA @ 2024-02-10 09:03:02
我也是这么想,但TLE五个点
by QWQAWAQWQAWA @ 2024-02-10 09:08:23
好像要用快速幂?