답안 #90415

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
90415 2018-12-21T15:13:24 Z igzi 비교 (balkan11_cmp) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include ″cmp.h″

using namespace std;

int a[5]={6,8,10,12};
int b[5]={1,6,48,480};
int pos[5]={1,7,15,25};

void remember(int val){
int i,tmp;
for(i=0;i<4;i++){
tmp=val%a[i];
bit_set(pos[i]+tmp);
val/=a[i];
}
}

int compare(int val){
int i,tmp,j;
for(i=3;i>=0;i--){
tmp=val/b[i];
val%=b[i];
if(bit_get(pos[i]+tmp)) continue;
if(tmp+1<=a[i]/2){
for(j=0;j<tmp;j++){
if(bit_get(pos[i]+j)) return 1;
}
return -1;
}
else{
for(j=tmp+1;j<pos[i]+a[i];j++){
if(bit_get(pos[i]+j)) return -1;
}
return 1; 
}
}
return 0;
}

Compilation message

cmp.cpp:2:10: error: #include expects "FILENAME" or <FILENAME>
 #include ″cmp.h″
          ^
cmp.cpp: In function 'void remember(int)':
cmp.cpp:14:1: error: 'bit_set' was not declared in this scope
 bit_set(pos[i]+tmp);
 ^~~~~~~
cmp.cpp:14:1: note: suggested alternative: 'tzset'
 bit_set(pos[i]+tmp);
 ^~~~~~~
 tzset
cmp.cpp: In function 'int compare(int)':
cmp.cpp:24:4: error: 'bit_get' was not declared in this scope
 if(bit_get(pos[i]+tmp)) continue;
    ^~~~~~~
cmp.cpp:27:4: error: 'bit_get' was not declared in this scope
 if(bit_get(pos[i]+j)) return 1;
    ^~~~~~~
cmp.cpp:33:4: error: 'bit_get' was not declared in this scope
 if(bit_get(pos[i]+j)) return -1;
    ^~~~~~~