代码在本地可以正常工作,但是Codeforces中的运行时错误呢?

2024-06-16 18:43:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着做codeforces中的第一个问题只是为了熟悉它。 当我在Ipython笔记本上尝试时,它会给出结果,但是当我在codeforces上上传它时,它总是给出运行时错误。有人能帮忙吗?在

Problem

Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.

What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.

输入: 输入在第一行包含三个正整数:n, m和a(1≤ n, m, a≤ 109)。在

输出: 写出所需数量的石板。在

示例测试用例:

Input - 6 6 4   , Output - 4

我的尝试:

^{pr2}$

编辑: 除了“测试1上的运行时错误”之外,没有太多关于该错误的解释。另外,如果有帮助的话,使用的时间是92毫秒,使用的内存是0 KB。在


Tags: ofthetocitysizeis错误with
2条回答
n=input('enter the value of n')
m=input('enter the value of m')

a=input('enter the value of a')

c=(n*m)/(a*a);
print'no. of flags=',c

我将您的代码粘贴到Codeforces中,并将语言设置为“python2.7”,并被接受了。在

相关问题 更多 >