제출 #796962

#제출 시각아이디문제언어결과실행 시간메모리
796962vjudge1비스킷 담기 (IOI20_biscuits)C++17
컴파일 에러
0 ms0 KiB
#include "biscuits.h" #include<algorithm> long long count_tastiness(long long x, std::vector<long long> a) int ans = 0, sum = 0; for(int i = 0; i < a.size(); i++) { sum+=a[i]<<i; } if(x>sum) return 1; for(int y = 0; y <= sum/x; y++) { std::vector<long long> a2 = a; for(int i = 0; i < x; i++) { long long rem=y; for(int j = a.size(); j--;) { int need = std::min(a2[j], rem>>j); rem-=need<<j; a2[j]-=need; } if(rem) break; if(i==x-1) ans++; } } return ans; }

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

biscuits.cpp:4:2: error: expected initializer before 'int'
    4 |  int ans = 0, sum = 0;
      |  ^~~
biscuits.cpp:5:5: error: expected unqualified-id before 'for'
    5 |     for(int i = 0; i < a.size(); i++) {
      |     ^~~
biscuits.cpp:5:20: error: 'i' does not name a type
    5 |     for(int i = 0; i < a.size(); i++) {
      |                    ^
biscuits.cpp:5:34: error: 'i' does not name a type
    5 |     for(int i = 0; i < a.size(); i++) {
      |                                  ^
biscuits.cpp:8:5: error: expected unqualified-id before 'if'
    8 |     if(x>sum) return 1;
      |     ^~
biscuits.cpp:9:5: error: expected unqualified-id before 'for'
    9 |     for(int y = 0; y <= sum/x; y++) {
      |     ^~~
biscuits.cpp:9:20: error: 'y' does not name a type
    9 |     for(int y = 0; y <= sum/x; y++) {
      |                    ^
biscuits.cpp:9:32: error: 'y' does not name a type
    9 |     for(int y = 0; y <= sum/x; y++) {
      |                                ^
biscuits.cpp:24:5: error: expected unqualified-id before 'return'
   24 |     return ans;
      |     ^~~~~~
biscuits.cpp:25:1: error: expected declaration before '}' token
   25 | }
      | ^