제출 #735918

#제출 시각아이디문제언어결과실행 시간메모리
735918josanneo22Coins (IOI17_coins)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>#include "coins.h"std::vector<int> coin_flips(std::vector<int> b, int c) { std::vector<int> flips(1); int now = 0; for(int i = 0; i< 64; i++) { if(b[i]) now = now^i; } int change = now^c; flips[0] = change; return flips; } int find_coin(std::vector<int> b) { int now = 0; for(int i = 0; i< 64; i++) { if(b[i]) now = now^i; } return now; }

컴파일 시 표준 에러 (stderr) 메시지

coins.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>#include "coins.h"std::vector<int> coin_flips(std::vector<int> b, int c) {    std::vector<int> flips(1);    int now = 0; for(int i = 0; i< 64; i++) {
      |                         ^
coins.cpp:2:3: error: expected unqualified-id before 'if'
    2 |   if(b[i]) now = now^i;
      |   ^~
coins.cpp:3:2: error: expected declaration before '}' token
    3 |  }
      |  ^
coins.cpp:4:15: error: 'now' was not declared in this scope; did you mean 'pow'?
    4 |  int change = now^c;
      |               ^~~
      |               pow
coins.cpp:4:19: error: 'c' was not declared in this scope
    4 |  int change = now^c;
      |                   ^
coins.cpp:5:2: error: 'flips' does not name a type
    5 |  flips[0] = change;
      |  ^~~~~
coins.cpp:6:5: error: expected unqualified-id before 'return'
    6 |     return flips;
      |     ^~~~~~
coins.cpp:7:1: error: expected declaration before '}' token
    7 | }
      | ^