Submission #14590

# Submission time Handle Problem Language Result Execution time Memory
14590 2015-05-20T15:14:47 Z ioojh6654 볼질 (OJUZ10_ballparade) C++
Compilation error
0 ms 0 KB
#include<stdio.h>

int main()
{
	int throw[50000];
	int a[5];
	int n;
	scanf("%d", &n);
	
	int i, ball=0, score=0;
	
	
	for(i=1; i<=n; i++)scanf("%d", &throw[i]);
	
	for(i=1; i<=4; i++)a[i]=0;
	
	for(i=1; i<=n; i++)
	{
		if(throw[i]==1)
		{
			ball++;
			
			if(ball>3)
			{
				ball=0;
				if(a[3]==1&&a[2]==1&&a[1]==1) score++;
				else if(a[3]==0&&a[2]==1&&a[1]==1)a[3]=1;
				else if((a[3]==0&&a[2]==0&&a[1]==1)||(a[3]==1&&a[2]==0&&a[1]==1))a[2]=1;
				else a[1]=1;
			}
		}
		
		else if(throw[i]==2)
		{
			ball=0;
			if(a[3]==1&&a[2]==1&&a[1]==1)score++;
			else if(a[3]==0&&a[2]==1&&a[1]==1)a[3]=1;
			else if((a[3]==0&&a[2]==0&&a[1]==1)||(a[3]==1&&a[2]==0&&a[1]==1))a[2]=1;
			else a[1]=1;
		}
		
		else
		{
			ball++;
			if(a[3]==1)
			{
				score++;
				a[3]=0;
			}
			if(a[2]==1)
			{
				a[3]=1;
				a[2]=0;
			}
			if(a[1]==1)
			{
				a[2]=1;
				a[1]=0;
			}
			if(ball>3)
			{
				ball=0;
				a[1]=1;
			}
		}
	}
	
	printf("%d", score);
	
}

Compilation message

ballparade.cpp: In function ‘int main()’:
ballparade.cpp:5:6: error: expected unqualified-id before ‘throw’
  int throw[50000];
      ^
ballparade.cpp:13:34: error: expected primary-expression before ‘throw’
  for(i=1; i<=n; i++)scanf("%d", &throw[i]);
                                  ^
ballparade.cpp: In lambda function:
ballparade.cpp:19:14: error: expected ‘{’ before ‘==’ token
   if(throw[i]==1)
              ^
ballparade.cpp: In function ‘int main()’:
ballparade.cpp:19:14: warning: lambda expressions only available with -std=c++11 or -std=gnu++11
ballparade.cpp:19:14: error: no match for ‘operator==’ (operand types are ‘main()::<lambda()>’ and ‘int’)
ballparade.cpp: In lambda function:
ballparade.cpp:33:19: error: expected ‘{’ before ‘==’ token
   else if(throw[i]==2)
                   ^
ballparade.cpp: In function ‘int main()’:
ballparade.cpp:33:19: warning: lambda expressions only available with -std=c++11 or -std=gnu++11
ballparade.cpp:33:19: error: no match for ‘operator==’ (operand types are ‘main()::<lambda()>’ and ‘int’)
ballparade.cpp:8:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^