Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
24466 | LeoWang | 数字组合 | C++ | Accepted | 0 MS | 240 KB | 451 | 2023-08-13 01:16:25 |
#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; }