QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#65659#4585. Greedy KnapsackGuanYunchangCompile Error//C1.9kb2022-12-02 19:52:142022-12-02 19:52:17

Details

answer.code: In function ‘GreedyKnapsack’:
answer.code:22:8: error: expected expression before ‘float’
   22 |     cu=float(m);
      |        ^~~~~
answer.code: At top level:
answer.code:35:1: error: unknown type name ‘bool’
   35 | bool compare1(int i,int j){
      | ^~~~
answer.code: In function ‘compare1’:
answer.code:37:16: error: ‘true’ undeclared (first use in this function)
   37 |         return true;
      |                ^~~~
answer.code:37:16: note: each undeclared identifier is reported only once for each function it appears in
answer.code:38:17: error: ‘false’ undeclared (first use in this function); did you mean ‘fclose’?
   38 |     else return false;
      |                 ^~~~~
      |                 fclose
answer.code: At top level:
answer.code:41:1: error: unknown type name ‘bool’
   41 | bool compare2(int i,int j){
      | ^~~~
answer.code: In function ‘compare2’:
answer.code:43:16: error: ‘true’ undeclared (first use in this function)
   43 |         return true;
      |                ^~~~
answer.code:44:17: error: ‘false’ undeclared (first use in this function); did you mean ‘fclose’?
   44 |     else return false;
      |                 ^~~~~
      |                 fclose
answer.code: At top level:
answer.code:48:1: error: unknown type name ‘bool’
   48 | bool compare3(int i,int j){
      | ^~~~
answer.code: In function ‘compare3’:
answer.code:50:16: error: ‘true’ undeclared (first use in this function)
   50 |         return true;
      |                ^~~~
answer.code:51:17: error: ‘false’ undeclared (first use in this function); did you mean ‘fclose’?
   51 |     else return false;
      |                 ^~~~~
      |                 fclose
answer.code: At top level:
answer.code:53:15: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
   53 | void swap(int &a,int &b){
      |               ^
answer.code: In function ‘sort’:
answer.code:79:17: warning: implicit declaration of function ‘swap’ [-Wimplicit-function-declaration]
   79 |                 swap(p[i],p[k]);
      |                 ^~~~