Submission #16319

# Submission time Handle Problem Language Result Execution time Memory
16319 2015-08-21T08:03:36 Z tonyjjw 속이기 (GA5_fake) C++14
Compilation error
0 ms 0 KB
#include<stdio.h>

int main(){
  scanf("%d",&N);
  int sum=0,min=1e9,xor=0;
  int v;
  for(int i=0;i<N;i++){
    scanf("%d",&v);
    sum+=v;
    xor^=v;
    if(min>v)min=v;
  }
  if(xor==0){
    printf("%d",sum-min);
  }
  else
    puts("0");
  return 0;
}

Compilation message

fake.cpp: In function ‘int main()’:
fake.cpp:4:15: error: ‘N’ was not declared in this scope
   scanf("%d",&N);
               ^
fake.cpp:5:21: error: expected unqualified-id before ‘xor’ token
   int sum=0,min=1e9,xor=0;
                     ^
fake.cpp:10:5: error: expected primary-expression before ‘xor’ token
     xor^=v;
     ^
fake.cpp:10:8: error: expected primary-expression before ‘^=’ token
     xor^=v;
        ^
fake.cpp:13:6: error: expected primary-expression before ‘xor’ token
   if(xor==0){
      ^
fake.cpp:13:9: error: expected primary-expression before ‘==’ token
   if(xor==0){
         ^
fake.cpp:8:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&v);
                   ^