답안 #760769

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
760769 2023-06-18T12:16:50 Z voliaanyk CONSUL (info1cup19_consul) C++14
컴파일 오류
0 ms 0 KB
void solve(int n){
    
    bool w = 0;
    
    for(int i=1;i<=30;i++){
        
        int x = rand() % n + 1;
        x = kth(x);
        int c = cnt(x);
        
        if(c>n*1.0/3){
            w = x;
            break;
        }
        
    }
    if(w) say_answer(w);
    else say_answer(-1);
    
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:8:17: error: 'rand' was not declared in this scope
    8 |         int x = rand() % n + 1;
      |                 ^~~~
consul.cpp:9:13: error: 'kth' was not declared in this scope
    9 |         x = kth(x);
      |             ^~~
consul.cpp:10:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   10 |         int c = cnt(x);
      |                 ^~~
      |                 int
consul.cpp:18:11: error: 'say_answer' was not declared in this scope
   18 |     if(w) say_answer(w);
      |           ^~~~~~~~~~
consul.cpp:19:10: error: 'say_answer' was not declared in this scope
   19 |     else say_answer(-1);
      |          ^~~~~~~~~~