Submission #14040

# Submission time Handle Problem Language Result Execution time Memory
14040 2015-04-25T15:02:04 Z jinmo123 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1084 KB
#include <stdio.h>

//int taja = 0;
int len;
char ball = 0;
char m[3]={0,};
int score = 0;

void jinru() {
  if(m[0]) {
    if(m[1]) {
      if(m[2]) {
        m[2] = 0;
        score++;
      }
      m[2] = m[1];
    }
    m[1] = m[0];
  }
  ball = 0;
}

int main() {
  scanf("%d", &len);
  int i;
  for(i = 0; i < len; i++) {
    int b;
    scanf("%d", &b);
    switch(b) {
      case 1:
      ball++;
      //printf("Ball! %d\n", taja);
      if(ball == 4) {
      	jinru();
        m[0] = 1;
        //taja++;
      }
      break;
      case 2:
        //printf("Deadball! %d\n", taja);
        jinru();
        m[0] = 1;
        //taja++;
      break;
      case 3:
      if(m[2]) score++;
      m[2] = m[1];
      m[1] = m[0];
      if(ball == 3) {
        ball = 0;
        m[0] = 1;
        //printf("Poktu! %d\n", taja++);
      }
      else {
        ball++;
        m[0] = 0;
        //printf("Poktu! %d\n", taja);
      }
      break;
    }
  }
  printf("%d", score);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 3 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 7 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
8 Correct 4 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1084 KB Output is correct
2 Correct 6 ms 1084 KB Output is correct
3 Correct 6 ms 1084 KB Output is correct
4 Correct 7 ms 1084 KB Output is correct
5 Correct 4 ms 1084 KB Output is correct
6 Correct 3 ms 1084 KB Output is correct
7 Correct 7 ms 1084 KB Output is correct
8 Correct 4 ms 1084 KB Output is correct
9 Correct 5 ms 1084 KB Output is correct
10 Correct 0 ms 1084 KB Output is correct
11 Correct 0 ms 1084 KB Output is correct
12 Correct 0 ms 1084 KB Output is correct
13 Correct 0 ms 1084 KB Output is correct
14 Correct 0 ms 1084 KB Output is correct
15 Correct 0 ms 1084 KB Output is correct