답안 #313380

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
313380 2020-10-15T22:49:06 Z ly20 Broken Device (JOI17_broken_device) C++17
컴파일 오류
0 ms 0 KB
#include "Annalib.h"

void Anna( int N, long long X, int K, int P[] ){
    bool rs[200], marc[200];
    int n = N, k = K;
    for(int i = 0; i < n; i++) {
        rs[i] = 0;
    }
    for(int i = 0; i < k; i++) {
        marc[P[i]] = 1;
    }
    int pot = 59;
    for(int i = 0; i < n - 1; i++) {
        if(pot < 0) break;
        if(marc[i] = 0 && marc[i + 1] == 0) {
            rs[i] = 1;
            if((1LL << pot) & X) rs[i + 1] = 1;
            else rs[i + 1] = 0;
            i++;
            pot--;
        }
    }
    for( int i = 0; i < N; i++ ){
        Set( i, rs[i] );
    }
}
#include "Brunolib.h"

long long Bruno( int N, int A[] ){
  int  pot = 59;
  long long resp = 0;
  for(int i = 0; i < N; i++) {
    if(pot < 0) break;
    if(A[i] == 1) {
        resp += ((long long) A[i + 1] << pot);
        i++
        pot--;
    }
  }

  return resp;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:15:20: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   15 |         if(marc[i] = 0 && marc[i + 1] == 0) {
      |            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:10:12: error: expected ';' before 'pot'
   10 |         i++
      |            ^
      |            ;
   11 |         pot--;
      |         ~~~