fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. int main()
  5. {
  6. int n,xe=1,seat=4,i=0;
  7. scanf("%d\n",&n);
  8. char a[n];
  9. gets(a);
  10. while(i<n){
  11. if(seat-a[i]==0){
  12. xe++;
  13. seat=4;
  14. i++;continue;
  15. }
  16. if(seat-a[i]>0){
  17. seat=seat-a[i];
  18. i++;continue;
  19. }
  20. if(seat-a[i]<0){
  21. xe++;
  22. seat=4;
  23. continue;
  24. }
  25. }
  26. printf("%d",xe);
  27.  
  28.  
  29. }#include <iostream>
  30. using namespace std;
  31.  
  32. int main() {
  33. // your code goes here
  34. return 0;
  35. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5
1 1 2 2 3
compilation info
prog.cpp:29:2: error: stray ‘#’ in program
 }#include <iostream>
  ^
prog.cpp: In function ‘int main()’:
prog.cpp:9:8: error: ‘gets’ was not declared in this scope
  gets(a);
        ^
prog.cpp: At global scope:
prog.cpp:29:3: error: ‘include’ does not name a type
 }#include <iostream>
   ^~~~~~~
prog.cpp: In function ‘int main()’:
prog.cpp:32:5: error: redefinition of ‘int main()’
 int main() {
     ^~~~
prog.cpp:4:5: note: ‘int main()’ previously defined here
 int main()
     ^~~~
stdout
Standard output is empty