标签:ace pac nbsp 重复 d3d none ++ vat open
1 #include <iostream> 2 #include <unordered_map> 3 #include <algorithm> 4 #include <vector> 5 #include <queue> 6 7 using namespace std; 8 9 class Solution 10 { 11 private: 12 int need_typesize; 13 int total_typesize = 43; 14 int result = 0; 15 public: 16 int DFS(int number) 17 { 18 need_typesize = number; 19 vector<int> tmp; 20 _DFS(0,tmp); 21 return result; 22 } 23 void _DFS(int start,vector<int>& tmp) 24 { 25 if(tmp.size()==need_typesize) 26 { 27 result ++; 28 } 29 else if(tmp.size()<need_typesize) 30 { 31 for(int i = start;i < total_typesize;i ++) 32 { 33 // vector<int> tmp2 = tmp; 34 // _DFS(start+1,tmp2); 35 tmp.emplace_back(i); 36 _DFS(start+1,tmp); 37 tmp.pop_back(); 38 } 39 } 40 } 41 }; 42 43 int main() 44 { 45 Solution obj; 46 int result = obj.DFS(3); 47 cout << result << endl; 48 // for(auto v:result) 49 // { 50 // for(auto s:v) 51 // { 52 // cout << s << " "; 53 // } 54 // cout << endl; 55 // } 56 return 0; 57 }
1 #include <iostream> 2 #include <unordered_map> 3 #include <algorithm> 4 #include <vector> 5 #include <queue> 6 7 using namespace std; 8 9 class Solution 10 { 11 private: 12 int need_typesize; 13 int total_typesize = 23; 14 int result = 0; 15 public: 16 int DFS(int number) 17 { 18 need_typesize = number; 19 vector<int> tmp; 20 _DFS(tmp); 21 return result; 22 } 23 void _DFS(vector<int>& tmp) 24 { 25 if(tmp.size()==need_typesize) 26 { 27 result ++; 28 } 29 else if(tmp.size()<need_typesize) 30 { 31 for(int i = 0;i < total_typesize;i ++) 32 { 33 // vector<int> tmp2 = tmp; 34 // _DFS(start+1,tmp2); 35 tmp.emplace_back(i); 36 _DFS(tmp); 37 tmp.pop_back(); 38 } 39 } 40 } 41 }; 42 43 int main() 44 { 45 Solution obj; 46 int result = obj.DFS(6); 47 cout << result << endl; 48 // for(auto v:result) 49 // { 50 // for(auto s:v) 51 // { 52 // cout << s << " "; 53 // } 54 // cout << endl; 55 // } 56 return 0; 57 }
1 #include <iostream> 2 #include <unordered_map> 3 #include <algorithm> 4 #include <vector> 5 #include <queue> 6 7 using namespace std; 8 9 class Solution 10 { 11 private: 12 int need_typesize; 13 int total_typesize = 19; 14 int result = 0; 15 public: 16 int DFS(int number) 17 { 18 need_typesize = number; 19 vector<int> tmp; 20 _DFS(0,tmp); 21 return result; 22 } 23 void _DFS(int start,vector<int>& tmp) 24 { 25 if(tmp.size()==need_typesize) 26 { 27 result ++; 28 // for(auto d:tmp) 29 // cout << d << " "; 30 // cout << endl; 31 } 32 else if(tmp.size()<need_typesize) 33 { 34 for(int i = start;i < total_typesize;i ++) 35 { 36 // vector<int> tmp2 = tmp; 37 // _DFS(start+1,tmp2); 38 tmp.emplace_back(i); 39 _DFS(i,tmp); 40 tmp.pop_back(); 41 } 42 } 43 } 44 }; 45 46 int main() 47 { 48 Solution obj; 49 int result = obj.DFS(6); 50 cout << result << endl; 51 // for(auto v:result) 52 // { 53 // for(auto s:v) 54 // { 55 // cout << s << " "; 56 // } 57 // cout << endl; 58 // } 59 return 0; 60 }
1 #include <iostream> 2 #include <unordered_map> 3 #include <algorithm> 4 #include <vector> 5 #include <queue> 6 7 using namespace std; 8 9 class Solution 10 { 11 private: 12 int need_typesize; 13 int total_typesize = 19; 14 int result = 0; 15 public: 16 int DFS(int number) 17 { 18 need_typesize = number; 19 vector<int> tmp; 20 _DFS(0,tmp); 21 return result; 22 } 23 void _DFS(int start,vector<int>& tmp) 24 { 25 if(tmp.size()==need_typesize) 26 { 27 result ++; 28 // for(auto d:tmp) 29 // cout << d << " "; 30 // cout << endl; 31 } 32 else if(tmp.size()<need_typesize) 33 { 34 for(int i = start;i < total_typesize;i ++) 35 { 36 // vector<int> tmp2 = tmp; 37 // _DFS(start+1,tmp2); 38 tmp.emplace_back(i); 39 _DFS(i+1,tmp); 40 tmp.pop_back(); 41 } 42 } 43 } 44 }; 45 46 int main() 47 { 48 Solution obj; 49 int result = obj.DFS(6); 50 cout << result << endl; 51 // for(auto v:result) 52 // { 53 // for(auto s:v) 54 // { 55 // cout << s << " "; 56 // } 57 // cout << endl; 58 // } 59 return 0; 60 }
标签:ace pac nbsp 重复 d3d none ++ vat open
原文地址:https://www.cnblogs.com/Asurudo/p/9494852.html