fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define main dummy_main
  5. int main(){
  6. return 0;
  7. }
  8. #undef main
  9. class ProductOfNumbers{
  10. public:
  11. vector<int> v;
  12. ProductOfNumbers(){
  13. v.push_back(1);
  14. }
  15. void add(int num){
  16. if(num==0){
  17. v.clear();
  18. v.push_back(1);
  19. }
  20. else{
  21. v.push_back(num * v.back());
  22. }
  23. }
  24. int getProduct(int k){
  25. if(v.size() <= k){
  26. return 0;
  27. }
  28. return v[v.size()-1] / v[v.size()-1-k];
  29. }
  30. }
  31. ;
  32. // cLay varsion 20200214-1
  33.  
  34. // --- original code ---
  35. // #define main dummy_main
  36. // {}
  37. // #undef main
  38. //
  39. // class ProductOfNumbers {
  40. // public:
  41. // vector<int> v;
  42. // ProductOfNumbers() {
  43. // v.push_back(1);
  44. // }
  45. //
  46. // void add(int num) {
  47. // if(num==0){
  48. // v.clear();
  49. // v.push_back(1);
  50. // } else {
  51. // v.push_back(num * v.back());
  52. // }
  53. // }
  54. //
  55. // int getProduct(int k) {
  56. // if(v.size() <= k) return 0;
  57. // return v[v.size()-1] / v[v.size()-1-k];
  58. // }
  59. // };
  60.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty