Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
46321 | 徐若宸 | 分成整数 | C++ | Accepted | 1 MS | 248 KB | 385 | 2024-05-03 09:57:58 |
#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; }