Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
46317 | Songgy_King | 分成整数 | C++ | Accepted | 0 MS | 244 KB | 428 | 2024-05-03 09:54:24 |
#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<<endl; return 0; }