fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define faster() \
  4.   ios_base ::sync_with_stdio(0); \
  5.   cin.tie(NULL); \
  6.   cout.tie(NULL);
  7. #define FOr(i, a, b) for (int i = a; i < b; i++)
  8. #define FOR(i, a, b) for (int i = a; i <= b; i++)
  9. using namespace std;
  10. string s = "";
  11. void solve(int pos)
  12. {
  13. if (s.size() == 10)
  14. {
  15. if (s[6] != '0' && s[3] != '2')
  16. {
  17. string tmp = s;
  18. reverse(tmp.begin(), tmp.end());
  19. if (s == tmp)
  20. {
  21. cout << s << endl;
  22. }
  23. }
  24. return;
  25. }
  26. if (pos == 2 || pos == 5)
  27. {
  28. s.push_back('/');
  29. solve(pos + 1);
  30. s.pop_back();
  31. }
  32. else
  33. {
  34. s.push_back('0');
  35. solve(pos + 1);
  36. s.pop_back();
  37. s.push_back('2');
  38. solve(pos + 1);
  39. s.pop_back();
  40. }
  41. }
  42. int main()
  43. {
  44. solve(0);
  45. }
  46.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty