답안 #767403

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
767403 2023-06-26T17:50:47 Z sraeli Archery (IOI09_archery) C
컴파일 오류
0 ms 0 KB
#include <stdio.h>

int encontrar_posicao_inicial(int N, int minhaClassificacao, int* competitorRanks) {
    int melhorPosicao = 1;

    for (int i = 0; i < 2 * N - 1; i += 2) {
        if (competitorRanks[i] < minhaClassificacao) {
            melhorPosicao++;
        }
    }

    return melhorPosicao;
}

int main() {
    int N, R;
    void scanf("%d %d", &N, &R);

    int minhaClassificacao;
    void scanf("%d", &minhaClassificacao);

    int competitorRanks[2 * N - 1];
    for (int i = 0; i < 2 * N - 1; i++) {
        void scanf("%d", &competitorRanks[i]);
    }

    int posicaoInicial = encontrar_posicao_inicial(N, minhaClassificacao, competitorRanks);
    printf("%d\n", posicaoInicial);

    return 0;
}

Compilation message

archery.c: In function 'main':
archery.c:17:16: error: expected declaration specifiers or '...' before string constant
   17 |     void scanf("%d %d", &N, &R);
      |                ^~~~~~~
archery.c:17:25: error: expected declaration specifiers or '...' before '&' token
   17 |     void scanf("%d %d", &N, &R);
      |                         ^
archery.c:17:29: error: expected declaration specifiers or '...' before '&' token
   17 |     void scanf("%d %d", &N, &R);
      |                             ^
archery.c:20:16: error: expected declaration specifiers or '...' before string constant
   20 |     void scanf("%d", &minhaClassificacao);
      |                ^~~~
archery.c:20:22: error: expected declaration specifiers or '...' before '&' token
   20 |     void scanf("%d", &minhaClassificacao);
      |                      ^
archery.c:24:20: error: expected declaration specifiers or '...' before string constant
   24 |         void scanf("%d", &competitorRanks[i]);
      |                    ^~~~
archery.c:24:26: error: expected declaration specifiers or '...' before '&' token
   24 |         void scanf("%d", &competitorRanks[i]);
      |                          ^
archery.c:16:12: warning: unused variable 'R' [-Wunused-variable]
   16 |     int N, R;
      |            ^