제출 #696960

#제출 시각아이디문제언어결과실행 시간메모리
696960noobnessOVERLOADEDBest Place (NOI17_bestplace)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  int a[n];
  int b[n];

  for(int i = 0; i <= n-1; i++){
    cin >> a[i];
  }

  for(int j = 0; j <= n-1; j++){
    cin >> b[j];
  }

  sort(a, a+n);
  sort(b, b+n);

  if(n % 2 = 0){
    int c = n/2;
    int sum1 = (a[c]+a[c+1])/2;
    int sum2 = (b[c]+b[c+1])/2;

    cout << sum1 << " " << sum2;
  }

  else{
    int c = n/2;
    int sum1 = a[c+1];
    int sum2 = b[c+1];

    cout << sum1 << " " << sum2;
  }


}

컴파일 시 표준 에러 (stderr) 메시지

bestplace.cpp: In function 'int main()':
bestplace.cpp:21:8: error: lvalue required as left operand of assignment
   21 |   if(n % 2 = 0){
      |      ~~^~~