C# 关于可编码性的Equi程序
有没有人在C# 关于可编码性的Equi程序,c#,.net,C#,.net,有没有人在.NET2.0上使用C#在Codility上试用过Equi演示程序? 我运行了我的解决方案,它给出了一个错误 cs(25,9):错误CS0246:类型或命名空间名称“Solution” 找不到。是否缺少using指令或程序集 推荐人 为了测试编译器,我接下来只运行了一个空白脚本。我得到了与上面相同的错误。这是他们的编译器的错误吗?使用系统; using System; class Solution { public int solution(int[] A) {
.NET2.0
上使用C#
在Codility上试用过Equi演示程序?
我运行了我的解决方案,它给出了一个错误
cs(25,9):错误CS0246:类型或命名空间名称“Solution”
找不到。是否缺少using指令或程序集
推荐人
为了测试编译器,我接下来只运行了一个空白脚本。我得到了与上面相同的错误。这是他们的编译器的错误吗?使用系统;
using System;
class Solution {
public int solution(int[] A) {
// first compute the sum of the array, put in second half sum.
int firstsum = 0;
int secondsum = 0;
foreach (int num in A)
{
secondsum += num;
}
// kepp an index
int index = 0;
while ( index <= A.Length -1 )
{
secondsum -= A[index];
if (secondsum == firstsum)
{
return index;
}
firstsum += A[index];
++ index;
}
return -1;
}
}
类解决方案{
公共int解决方案(int[]A){
//首先计算数组的和,放入下半个和。
int firstsum=0;
int secondsum=0;
foreach(A中的int num)
{
secondsum+=num;
}
//凯普指数
int指数=0;
而(索引使用长数据类型,它将得到100分
long firstsum = 0;
long secondsum = 0;
听起来好像忘了使用正确的using指令或程序集(如错误所述)。如果我们看到代码或其他东西会更好。@SonerGönül但当我运行一个blank时它会给出相同的错误。blank不应该正常执行而没有错误吗?您的解决方案的设置有问题。