답안 #16817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
16817 2015-09-30T23:39:24 Z kdh9949 속이기 (GA5_fake) C++
컴파일 오류
0 ms 0 KB
#include<stdio.h>
int n,k,xorsum,sum,max;
int main()
{
  scanf("%d",&n);
  for(int i=0;i<n;i++){
  	scanf("%d",&k);
    xorsum^=k;
    sum+=k;
    if(min<k)min=k;
  }
  printf("%d",xorsum?-1:sum-min);
}

Compilation message

fake.cpp: In function ‘int main()’:
fake.cpp:10:8: error: ‘min’ was not declared in this scope
     if(min<k)min=k;
        ^
fake.cpp:12:29: error: ‘min’ was not declared in this scope
   printf("%d",xorsum?-1:sum-min);
                             ^
fake.cpp:5:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&n);
                 ^
fake.cpp:7:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&k);
                  ^