10 solutions

  • 1
    @ 2024-11-30 11:11:00

    unsigned long long fi[10000000]一定得是全局变量,要不然会爆

    #include <bits/stdc++.h>
    using namespace std;
    unsigned long long  fi[10000000];
    int main()
    {
    	fi[2]=fi[1]=1;
    	int n;
    	cin>>n;
    	for(int i=3;i<=n;i++)
    	{
    		fi[i]=(fi[i-1]+fi[i-2])%10007;
    	}
    	cout<<fi[n];
    }
    

    Information

    ID
    38
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    2327
    Accepted
    309
    Uploaded By