Submission #24122

# Submission time Handle Problem Language Result Execution time Memory
24122 2017-05-31T10:57:42 Z ms990606 cmp (balkan11_cmp) C
Compilation error
0 ms 0 KB
#include "cmp.h"

void remember(int n) {
  int a[13],ans=0;
  for(int i=0;i<12;i++)
  {
    a[i]=((n&(1<<(11-i)))?1:0);
    ans+=a[i];
  }
  if(ans>6)
  {
    bit_set(0);
    for(int i=0;i<12;i++)
    {
      if(a[i]==0) bit_set(i+1);
    }
  }
  else
  {
    for(int i=0;i<12;i++)
    {
      if(!a[i]) bit_set(i+1);
    }
  }
  
}

int compare(int b) {
  a=bit_get(0);
  int c[13],d[13];
  for(int i=0;i<12;i++)
  {
    	c[i]=((b&(1<<(11-i)))?1:0);
    	d[i]=(bit_get(i+1)+a)%2;
    	if(c[i]>d[i]) return 1;
    	if(c[i]<d[i]) return -1;
  }
  return 0;
  
}

Compilation message

cmp.c: In function 'compare':
cmp.c:29:3: error: 'a' undeclared (first use in this function)
   a=bit_get(0);
   ^
cmp.c:29:3: note: each undeclared identifier is reported only once for each function it appears in