Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
56269 | zhangweiran | 数字组合 | C++ | Accepted | 0 MS | 244 KB | 451 | 2024-11-09 22:46:22 |
#include<iostream> using namespace std; int ans=0,n; bool IsUsed[15]; void dfs(int x) { if(x>3) { ans++; return; } for(int i=0;i<=n;i++) { if(x==1&&i==0) continue; if(x==3) { if(i%2==0) continue; } if(!IsUsed[i]) { IsUsed[i]=true; dfs(x+1); IsUsed[i]=false; } } return; } int main() { cin>>n; for(int i=0;i<=15;i++) IsUsed[i]=false; dfs(1); cout<<ans; return 0; }