提交时间:2024-05-03 09:35:54

运行 ID: 46308

#include <bits/stdc++.h> using namespace std; int cnt; bool ex_37(int n){ while(n){ if(n % 10 == 3 || n % 10 == 7){ return 0; } n /= 10; } return 1; } void dfs(int n, int k, int a){ if(k == 1){ if(n >= a){ cnt += ex_37(n); } return; } for(int i = a; i * k <= n; i++){ if(ex_37(i)){ dfs(n - i, k - 1, i + 1); } } } int main(){ int n; cin >> n; dfs(n, 3, 1); cout << cnt; return 0; }