답안 #18599

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18599 2016-02-10T11:51:00 Z jjhstop 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1084 KB
#include<stdio.h>
int base;
int score;
int ball;

void fball()
{
	switch (base) {
		case 0:
		case 2:
		case 4:
		case 6:
			base++;
			break;
		case 1:
		case 5:
			base += 2;
			break;
		case 3:
			base += 4;
			break;
		case 7:
		default:
			score++;
			break;
	}
}

void wball()
{
	switch (base) {
		case 4:
		case 5:
		case 6:
		case 7:
			score++;
			break;
		default:
			break;
	}
	base <<= 1;
	base &= 7;
}

void process(int a)
{
	switch (a) {
		case 1:
			ball++;
			if (ball == 4) {
				ball = 0;
				fball();
			}
			break;
		case 2:
			ball = 0;
			fball();
			break;
		case 3:
			ball++;
			wball();
			if (ball == 4) {
				fball();
				ball = 0;
			}
			break;
	}
}
int main()
{
	int N, t;
	//freopen("input.txt", "r", stdin);
	scanf("%d", &N);

	for (int i = 0; i < N; i++) {
		scanf("%d ", &t);
		process(t);
	}
	printf("%d", score);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 6 ms 1084 KB Output is correct
4 Correct 3 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 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1084 KB Output is correct
2 Correct 5 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 0 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 6 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 7 ms 1084 KB Output is correct
8 Correct 4 ms 1084 KB Output is correct
9 Correct 3 ms 1084 KB Output is correct
10 Correct 4 ms 1084 KB Output is correct
11 Correct 0 ms 1084 KB Output is correct
12 Correct 2 ms 1084 KB Output is correct
13 Correct 6 ms 1084 KB Output is correct
14 Correct 3 ms 1084 KB Output is correct
15 Correct 3 ms 1084 KB Output is correct