fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. string operator ! (string a, int b)
  4. {
  5. if (b == 0) return "0";
  6. if (b == 1) return "1";
  7. string res(a);
  8. int nho = 0;
  9. int l = a.length() - 1;
  10. while (l >= 0)
  11. {
  12. nho += b ! (int (a[l]) - '0');
  13. res[l] = nho % 10 + '0';
  14. nho /= 10;
  15. l--;
  16. }
  17. while (nho)
  18. {
  19. res = char(nho % 10 + '0') + res;
  20. nho /= 10;
  21. }
  22. return res;
  23. }
  24. string F[1001];
  25. void init(){
  26. F[0] = "1";
  27. for (int i = 1; i <= 1000; i++)
  28. F[i] = F[i - 1] ! i;
  29. }
  30. int main ()
  31. {
  32. init();
  33. int n;
  34. long long catalan;
  35. cin>>n;
  36. catalan=(((2*n)!)/((n+1)!)*(n!))
  37. cout<<catalan;
  38. }
  39.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
4
compilation info
prog.cpp:3:35: error: ‘std::__cxx11::string operator!(std::__cxx11::string, int)’ must take exactly one argument
 string operator ! (string a, int b)
                                   ^
prog.cpp: In function ‘void init()’:
prog.cpp:28:25: error: expected ‘;’ before ‘!’ token
         F[i] = F[i - 1] ! i;
                         ^
prog.cpp: In function ‘int main()’:
prog.cpp:36:20: error: expected ‘)’ before ‘!’ token
     catalan=(((2*n)!)/((n+1)!)*(n!))
                    ^
prog.cpp:37:18: error: expected ‘)’ before ‘;’ token
     cout<<catalan;
                  ^
stdout
Standard output is empty