제출 #1295996

#제출 시각아이디문제언어결과실행 시간메모리
1295996lukaye_19Packing Biscuits (IOI20_biscuits)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, long long[] a) { long long k = sizeof(a) / sizeof(a[0]); long long totaltastiness = 0 long long returnvalue = 0; for (long long i = 0; i < k; i++) { long long totalcookies = a[i]; totaltastiness += pow(2,i) * totalcookies; } for (long long i = 0; i < totaltastiness / x + 1; i++) { unordered_set<int>usedcookies; bool validtastevalue = true; for (long long j = 0; j < x; j++) { for (long long n = 0; n < pow(2,k); n++) { int cookievalue = 0; int asciivalue = n; for (long long m = k - 1; m >= 0; m--) { auto it = usedcookies.find(m); if (it == usedcookies.end()) { break; } int currentpower = pow(2,m); if (currentpower <= asciivalue) { cookievalue += a[m]; } } if (cookievalue == i) { for (long long m = k - 1; m >= 0; m--) { usedcookies.insert(m); } } else { validtastevalue = false; } } } if (validtastevalue) { returnvalue++; } } return returnvalue; }

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

biscuits.cpp:4:52: error: expected ',' or '...' before 'a'
    4 | long long count_tastiness(long long x, long long[] a)
      |                                                    ^
biscuits.cpp: In function 'long long int count_tastiness(long long int, long long int*)':
biscuits.cpp:6:24: error: 'a' was not declared in this scope
    6 |   long long k = sizeof(a) / sizeof(a[0]);
      |                        ^
biscuits.cpp:9:3: error: expected ',' or ';' before 'long'
    9 |   long long returnvalue = 0;
      |   ^~~~
biscuits.cpp:63:7: error: 'returnvalue' was not declared in this scope
   63 |       returnvalue++;
      |       ^~~~~~~~~~~
biscuits.cpp:67:10: error: 'returnvalue' was not declared in this scope
   67 |   return returnvalue;
      |          ^~~~~~~~~~~