1 solutions

  • 0
    @ 2024-12-4 19:37:03

    C++ :

    #include<iostream>
    using namespace std;
    int cnt=0;
    void f(int k,int score)
    {
    	int i;
    	if(k>10||score>90||score+(10-k)*10<90)//剪枝
    	{
    		return;
    	}
    	if(score==90)
    	{
    		cnt++;
    		return;
    	}
    	
    	for(i=0;i<=10;i++)
    	{
    		f(k+1,score+i);
    	}
    }
    int main()
    {
    	f(0,0);
    	cout<<cnt;
    	return 0;
    }
    
    
    • 1

    Information

    ID
    2249
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By