Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError: division by zero #11

Open
risemeup opened this issue Mar 22, 2021 · 10 comments
Open

ZeroDivisionError: division by zero #11

risemeup opened this issue Mar 22, 2021 · 10 comments

Comments

@risemeup
Copy link

请问,C++程序这个报错是什么问题。本地exe在别人机器上就能正常运行,求指点。

AutoGrader Running with args: ['c++', '', 'E:/huawei/CodeCraft-2021.exe', '', '', '', ['E:/huawei/training-1.txt']]
  0%|             | 0/1 [00:00<?, ?it/s]E:/huawei/2021/2021HWAutoGrader/2021HWAutoGrader-main/autograder.py:214: MatplotlibDeprecationWarning: normalize=None does not normalize if the sum is less than 1 but this behavior is deprecated since 3.3 until two minor releases later. After the deprecation period the default value will be normalize=True. To prevent normalization pass normalize=False 
  plt.pie(sizes, labels=labels, autopct='%1.2f%%')
  0%|             | 0/1 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "E:/huawei/2021/2021HWAutoGrader/2021HWAutoGrader-main/autograder.py", line 258, in <module>
    _ = grader(testCmd, d)
  File "E:/huawei/2021/2021HWAutoGrader/2021HWAutoGrader-main/autograder.py", line 220, in grader
    emptyRate), sum(energyCost) / len(energyCost), folderName, migTot, bombInfo, migOverInfo
ZeroDivisionError: division by zero

config.json内容如下:

{
  "language": "c++",
  "pythonInterpreter": "",
  "executable": "E:/huawei/CodeCraft-2021.exe",
  "sourceCode": "",
  "javaPath": "",
  "buildJARPath": "",
  "ioData": ["E:/huawei/training-1.txt"]
}
@Jerryporter
Copy link

分母为0了,看看你是不是输出有问题

@tongchuan1999
Copy link

我也是,请问解决了吗

@risemeup
Copy link
Author

我也是,请问解决了吗
我是下了几遍,后来下的就一直这个问题。最开始下载的版本可用,玄学。

@tongchuan1999
Copy link

我也是,请问解决了吗
我是下了几遍,后来下的就一直这个问题。最开始下载的版本可用,玄学。

你好,可以麻烦您发我一份最开始的吗?这个弄了挺久也没弄好。我的邮箱:2844957520@qq.com,谢谢您!

@VirgilG72
Copy link

+1,一样遇到这个问题

@tongchuan1999
Copy link

tongchuan1999 commented Mar 25, 2021 via email

@thw1023
Copy link

thw1023 commented Mar 25, 2021

你好,我昨天已经解决了我的这个问题,不是版本的原因,是因为输入输出的问题,输入用数据集读入,输出和线上提交code的输出必须一样的方式,否则会报这个错误。除此之外,建议json文件中路径用全英文,否则后续会报gdk的错误。 希望我的回复能对你有所帮助,祝比赛顺利。

---Original--- From: "Kong @.> Date: Thu, Mar 25, 2021 11:11 AM To: @.>; Cc: @.@.>; Subject: Re: [B1ACK917/2021HWAutoGrader] ZeroDivisionError: division by zero (#11) +1,一样遇到这个问题 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

同与此问题,想问下输入用数据集读入的意思是,代码中直接打开txt的意思不?

@tongchuan1999
Copy link

tongchuan1999 commented Mar 25, 2021 via email

@LIZ-CRYSTAL
Copy link

LIZ-CRYSTAL commented Mar 26, 2021

我使用python也遇到了这个问题。。我在config文件中设置了.py文件和数据集的.txt文件,并且写成了提交时相同的输出格式,但还是报错

return os.path.split(ioData)[-1], hardCost, sum(energyCost), endTime - beginTime, sum(emptyRate) / len(emptyRate),\ ZeroDivisionError: division by zero

@tongchuan1999
Copy link

tongchuan1999 commented Mar 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants