답안 #130903

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130903 2019-07-16T08:26:14 Z 송준혁(#3172) Snake (CEOI08_snake) C++14
컴파일 오류
0 ms 0 KB
#include <stdio.h>
#include "snakelib.h"

int K, R, L;
char a1, a2;

int main(){
    int l=0, r=12121;
    K = get_speed();
    while (1){
        int mid = (l+r)/2;
        ask_snake(mid, r, a1, a2);
        if (a2 != 'f'){
            R = r + K + 1;
            break;
        }
        if (a1 != 'f') l = mid + 1;
        else r = mid - 1;
    }

    l = 0, r = R;
    while (l<=r){
        int mid = (l+r)/2;
        ask_snake(mid, R, a1, a2);
        if (a1 == 'b') l = mid + 1;
        else r = mid-1, L = mid;
        if (a2 != 'f'){
            R += K;
            l += K, r += K, L += K;
            break;
        }
    }
    tell_length(R-L);
}

Compilation message

snake.cpp: In function 'int main()':
snake.cpp:12:33: error: invalid conversion from 'char' to 'char*' [-fpermissive]
         ask_snake(mid, r, a1, a2);
                                 ^
In file included from snake.cpp:2:0:
snakelib.h:7:6: note:   initializing argument 3 of 'void ask_snake(int, int, char*, char*)'
 void ask_snake(int, int, char*, char*);
      ^~~~~~~~~
snake.cpp:12:33: error: invalid conversion from 'char' to 'char*' [-fpermissive]
         ask_snake(mid, r, a1, a2);
                                 ^
In file included from snake.cpp:2:0:
snakelib.h:7:6: note:   initializing argument 4 of 'void ask_snake(int, int, char*, char*)'
 void ask_snake(int, int, char*, char*);
      ^~~~~~~~~
snake.cpp:24:33: error: invalid conversion from 'char' to 'char*' [-fpermissive]
         ask_snake(mid, R, a1, a2);
                                 ^
In file included from snake.cpp:2:0:
snakelib.h:7:6: note:   initializing argument 3 of 'void ask_snake(int, int, char*, char*)'
 void ask_snake(int, int, char*, char*);
      ^~~~~~~~~
snake.cpp:24:33: error: invalid conversion from 'char' to 'char*' [-fpermissive]
         ask_snake(mid, R, a1, a2);
                                 ^
In file included from snake.cpp:2:0:
snakelib.h:7:6: note:   initializing argument 4 of 'void ask_snake(int, int, char*, char*)'
 void ask_snake(int, int, char*, char*);
      ^~~~~~~~~