답안 #14296

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14296 2015-05-10T07:43:57 Z woqja125 볼질 (OJUZ10_ballparade) C++
100 / 100
6 ms 1084 KB
#include<stdio.h>
int main()
{
	int n, i, s=0, t;
	scanf("%d", &n);
	unsigned base = 0, bcount = 0;
	for(i=1; i<=n; i++)
	{
		scanf("%d", &t);
		switch(t)
		{
		case 3:
			base<<=1;
		case 1:
			bcount++;
			break;
		case 2:
			bcount = 4;
			break;
		}
		if(bcount == 4)
		{
			int x = ~base;
			x -= x&(-x);
			base = ~x;
			bcount = 0;
		}
		s += base/8; base %=8;
		//printf("#%d %d %d\n", s, base, bcount);
	}
	printf("%d", s);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 3 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
# 결과 실행 시간 메모리 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 0 ms 1084 KB Output is correct
5 Correct 3 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 4 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 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 4 ms 1084 KB Output is correct
8 Correct 5 ms 1084 KB Output is correct
9 Correct 0 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 5 ms 1084 KB Output is correct
15 Correct 6 ms 1084 KB Output is correct