/ Vijos /

记录详情

Compile Error

foo.cc: In function 'void addToHash(long long int)':
foo.cc:66:32: error: no matching function for call to '_nodeH::_nodeH(void*)'
   66 | p = (nodeH)malloc(sizeof(nodeH));
      |                                ^
foo.cc:8:16: note: candidate: '_nodeH::_nodeH()'
    8 | typedef struct _nodeH{
      |                ^~~~~~
foo.cc:8:16: note:   candidate expects 0 arguments, 1 provided
foo.cc:8:16: note: candidate: 'constexpr _nodeH::_nodeH(const _nodeH&)'
foo.cc:8:16: note:   no known conversion for argument 1 from 'void*' to 'const _nodeH&'
foo.cc:8:16: note: candidate: 'constexpr _nodeH::_nodeH(_nodeH&&)'
foo.cc:8:16: note:   no known conversion for argument 1 from 'void*' to '_nodeH&&'
foo.cc:67:2: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   67 | p->key = key;
      |  ^~
foo.cc:68:2: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   68 | p->next = hash[key % MAX_SIZE];
      |  ^~
foo.cc:69:24: error: cannot convert 'nodeH' {aka '_nodeH'} to 'nodeH*' {aka '_nodeH*'} in assignment
   69 | hash[key % MAX_SIZE] = p;
      |                        ^
      |                        |
      |                        nodeH {aka _nodeH}
foo.cc: In function 'int isInHash(long long int)':
foo.cc:72:30: error: conversion from 'nodeH*' {aka '_nodeH*'} to non-scalar type 'nodeH' {aka '_nodeH'} requested
   72 | nodeH p = hash[key % MAX_SIZE];
      |           ~~~~~~~~~~~~~~~~~~~^
foo.cc:73:9: error: no match for 'operator!=' (operand types are 'nodeH' {aka '_nodeH'} and 'long int')
   73 | while(p != NULL){
      |         ^
foo.cc:74:5: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   74 | if(p->key == key)
      |     ^~
foo.cc:76:6: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   76 | p = p->next;
      |      ^~
foo.cc: In function 'void addToQueue(long long int, int)':
foo.cc:85:41: error: no matching function for call to '_nodeQ::_nodeQ(void*)'
   85 | tail->next = (nodeQ)malloc(sizeof(nodeQ));
      |                                         ^
foo.cc:13:16: note: candidate: '_nodeQ::_nodeQ()'
   13 | typedef struct _nodeQ{
      |                ^~~~~~
foo.cc:13:16: note:   candidate expects 0 arguments, 1 provided
foo.cc:13:16: note: candidate: 'constexpr _nodeQ::_nodeQ(const _nodeQ&)'
foo.cc:13:16: note:   no known conversion for argument 1 from 'void*' to 'const _nodeQ&'
foo.cc:13:16: note: candidate: 'constexpr _nodeQ::_nodeQ(_nodeQ&&)'
foo.cc:13:16: note:   no known conversion for argument 1 from 'void*' to '_nodeQ&&'
foo.cc: In function 'int main()':
foo.cc:38:6: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 | scanf("%s", line);
      | ~~~~~^~~~~~~~~~~~
正在同步测试数据,请稍后
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1252 @.@斗地主
语言
C++
递交时间
2022-04-17 18:49:28
评测时间
2022-04-17 18:49:28
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes