3AC+6TLE+1WA,求条
查看原帖
3AC+6TLE+1WA,求条
1133254
wangjingxi_楼主2024/8/22 09:27

悬关,回复@我。
测试点信息:点这里。 代码如下:

#include<bits/stdc++.h>
using namespace std;
#define int long long
int x,y,z,h;
vector<int> a;
void sl(int lc) {
    if (lc <= h && find(a.begin(),a.end(),lc)==a.end()){
        a.push_back(lc);
        sl(lc + x);
        sl(lc + y);
        sl(lc + z);
    }
}

signed main() {
    cin >> h;
    cin >> x >> y >> z;
    sl(0);
    if(a.size() > 0)
        cout << a.size() - 1; 
    else
        cout << 0;
}
2024/8/22 09:27
加载中...