hihoCoder太阁最新面经算法竞赛6 register

Ended

Participants:104

Verdict:Accepted
Score:100 / 100
Submitted:2016-06-30 21:05:53

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//hihocoder 
#include<bits/stdc++.h>
//80
using namespace std;
vector<int> arr; 
void dfs(int index,int curr,int &res,vector<int> h)
{
    if(curr==0)
    {
        //for(auto i:h)cout<<i<<" ";cout<<endl;
        res++;
        return ;
    }
    if(index<0)
    {
        return ;
    }
    if(curr<0)
    {
        return ;
    }
    if((long long)curr>(long long)4*arr[index])
    {
        return ;
    }
    else
    {
        for(int i=0;i<3;++i)
        {
            //h.push_back(i);
            dfs(index-1,curr-i*arr[index],res,h);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX